Skip to content

Commit 4c6b1a2

Browse files
committed
Improve (and fix) entrypoint.sh
1 parent a16a7c6 commit 4c6b1a2

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2024-11-23
2+
3+
* Improve (and fix) entrypoint.sh
4+
15
2024-02-12
26

37
* Convert Action to a container

entrypoint.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
#!/bin/bash
22

3+
set -e
4+
35
echo ""
4-
echo "linuxdeploy Build Helper Container v2.0.0"
6+
echo "linuxdeploy Build Helper Container v2.0.1"
57
echo "https://github.com/andy5995/linuxdeploy-build-helper-container"
68
echo ""
79

810
OLDPWD=$PWD
911

10-
if [ -z "HOSTUID" ]; then
12+
if [ -z "$HOSTUID" ]; then
1113
echo "HOSTUID is not set."
1214
exit 1
1315
fi
1416

17+
if [ -z "$HOSTGID" ]; then
18+
echo "HOSTGID is not set."
19+
exit 1
20+
fi
21+
1522
if [ -z "$1" ]; then
1623
echo "One argument required -- the name of a script to run."
1724
exit 1
1825
fi
1926

20-
usermod -u $HOSTUID builder
21-
su builder -c "PATH=/home/builder/.local/bin:$PATH && cd $OLDPWD && $1"
27+
usermod -u "$HOSTUID" builder
28+
chown -R "$HOSTUID:$HOSTGID" /home/builder
29+
30+
# The docs state to use '-w /workdir when running the container, but switching
31+
# to builder here will change the directory. Using cd to change back...
32+
su builder -l -c "cd $OLDPWD && $1"

0 commit comments

Comments
 (0)