NordcomInc / devcontainer-features

Dev Container Features
https://nordcom.io/
MIT License
10 stars 5 forks source link

android-sdk: fix permission #19

Closed hellodword closed 8 months ago

hellodword commented 9 months ago

https://github.com/NordcomInc/devcontainer-features/blob/15c104a3708262e55a5eea1362e6da544210c6a7/src/android-sdk/install.sh#L57-L58

It seems that this will exit the whole install.sh

Reproduce with:

https://github.com/NordcomInc/devcontainer-features/blob/15c104a3708262e55a5eea1362e6da544210c6a7/test/android-sdk/test.sh#L6

check "execute command" bash -c "ls -alh $ANDROID_HOME"
hellodword commented 9 months ago

I guess this is not working in shell script:

https://github.com/NordcomInc/devcontainer-features/blob/15c104a3708262e55a5eea1362e6da544210c6a7/src/android-sdk/install.sh#L25

You can verify this with id or whoami after it

install.sh:

#!/bin/bash
set -e
set +H
set -x

sudo -Eu "$_REMOTE_USER" bash -x <<EOF
id
whoami
EOF

su - "$_REMOTE_USER"
id
whoami
exit 1

The outputs:

0.120 + sudo -Eu vscode bash -x
0.124 + id
0.125 uid=1000(vscode) gid=1000(vscode) groups=1000(vscode)
0.125 + whoami
0.126 vscode
0.127 + su - vscode
0.132 + id
0.133 uid=0(root) gid=0(root) groups=0(root)
0.133 + whoami
0.133 root
0.133 + exit 1