Skip to content

Commit 005057e

Browse files
committed
feat: select user
1 parent 2581b6e commit 005057e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

scripts/run-bootstrap.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/system/bin/sh
22
# Minimal proot run script
33

4+
if [ -z "$1" ] || [ -z "$2" ]; then
5+
echo "Usage: <user> <command>"
6+
exit 1
7+
fi
8+
49
BASE_DIR="$PWD"
510

611
export PROOT_TMP_DIR="$BASE_DIR/tmp"
@@ -9,12 +14,22 @@ export PROOT_L2S_DIR="$BASE_DIR/bootstrap/.proot.meta"
914
mkdir -p "$PROOT_TMP_DIR"
1015
mkdir -p "$PROOT_L2S_DIR"
1116

12-
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
13-
USER='root'
14-
HOME='/root'
17+
if [ "$1" = "root" ]; then
18+
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
19+
USER='root'
20+
HOME='/root'
21+
OP="-0"
22+
else
23+
OP=""
24+
USER="$1"
25+
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
26+
HOME="/home/$USER"
27+
fi
28+
29+
1530
unset TMPDIR
1631
unset LD_LIBRARY_PATH
1732
export PATH
1833
export USER
1934
export HOME
20-
./root/bin/proot -r bootstrap -b /dev -b /proc -b /sys -b /system -b /vendor -b /storage --link2symlink -p -L -w /root /bin/sh -l
35+
./root/bin/proot -r bootstrap $OP -b /dev -b /proc -b /sys -b /system -b /vendor -b /storage $EXTRA_BIND --link2symlink -p -L -w $HOME $2

0 commit comments

Comments
 (0)