USER is a standard global environment variable that contains the name
of the current user. Previously, build.sh would reassign user to be
the id of the current user. This would break podman, which uses $USER
to find the name of the user to look up in /etc/subuid.
Since environment variables are conventionally upper case, using
lowercase variable names in scripts avoids the problem of overriding
variables in the environment.
---
clients/android/build.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/clients/android/build.sh b/clients/android/build.sh
index 44cba421..eb559798 100755
--- a/clients/android/build.sh+++ b/clients/android/build.sh
@@ -2,18 +2,18 @@
set -e
-BASEDIR=$(realpath $(dirname "$0"))-USER=$(id -u)-GROUP=$(id -g)+basedir=$(realpath $(dirname "$0"))+user=$(id -u)+group=$(id -g)if [ $1 = "dev" ]; then
echo "Attaching shell for repeated builds."
echo "Don't invoke gradle yourself! Use 'client/android/.build_nested.sh' instead!"
echo "Don't forget to run 'export USER=$USER GROUP=$GROUP'!"
This should have been changed too, but I'm not sure what these
instructions are actually for. I think the idea is that
.build_nested.sh uses them, but looking at the source for that, it
actually uses positional arguments instead.
So I'm not really sure what to do with this until that's clarified.
If no argument was given, this script would produce the error:
./build.sh: line 9: [: =: unary operator expected
This happened because the expansion of the [ command became
[ = "dev" ]
Adding the quotes around $1 makes the expansion
[ "" = "dev" ]
Which is what we actually want.
---
clients/android/build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clients/android/build.sh b/clients/android/build.sh
index eb559798..b644bef0 100755
--- a/clients/android/build.sh+++ b/clients/android/build.sh
@@ -6,7 +6,7 @@ basedir=$(realpath $(dirname "$0"))
user=$(id -u)
group=$(id -g)
-if [ $1 = "dev" ]; then+if [ "$1" = "dev" ]; then echo "Attaching shell for repeated builds."
echo "Don't invoke gradle yourself! Use 'client/android/.build_nested.sh' instead!"
echo "Don't forget to run 'export USER=$USER GROUP=$GROUP'!"
--
2.26.2