Replace Bash $UID with portable $(id -u) in Docker scripts

@Pentarctagon noticed in commit 9a34cbb329 that $UID isn't set when
/bin/sh isn't GNU Bash.  `id -u` is specified by POSIX:
https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/id.html

Also move `-xe` to a `set` command (in case someone runs scripts with
`sh path/to/script` instead of `path/to/script`) and add `set -u` to
complain more loudly about such unset variables.
This commit is contained in:
P. J. McDermott 2024-02-13 14:24:08 -05:00 committed by Pentarctagon
parent fcb3ce33b7
commit b6d7d7ea18
4 changed files with 14 additions and 6 deletions

View File

@ -1,7 +1,9 @@
#!/bin/sh -xe
#!/bin/sh
set -xeu
cd mingw
docker build -t mingw-wesnoth .
rm -rf ../mingwbuild
mkdir ../mingwbuild
docker run -v "$PWD"/../../..:/wesnoth -v "$PWD"/../mingwbuild:/output --tmpfs /build -u "$UID" mingw-wesnoth
docker run -v "$PWD"/../../..:/wesnoth -v "$PWD"/../mingwbuild:/output --tmpfs /build -u "$(id -u)" mingw-wesnoth

View File

@ -1,4 +1,6 @@
#!/bin/sh -xe
#!/bin/sh
set -xeu
cd steamrt
docker build -t steamos-wesnoth .
@ -7,4 +9,4 @@ mkdir ../steambuild
if [ -d "$PWD"/../../../build ]; then
echo "Existing scons 'build' directory found, this may cause the build to fail!"
fi
docker run -v "$PWD"/../../..:/wesnoth -v "$PWD"/../steambuild:/output --tmpfs /build:exec -u "$UID" steamos-wesnoth
docker run -v "$PWD"/../../..:/wesnoth -v "$PWD"/../steambuild:/output --tmpfs /build:exec -u "$(id -u)" steamos-wesnoth

View File

@ -1,4 +1,6 @@
#!/bin/sh -xe
#!/bin/sh
set -xeu
VALVEFILE=com.valvesoftware.SteamRuntime.Sdk-amd64,i386-sniper-sysroot.Dockerfile
VALVETAR=com.valvesoftware.SteamRuntime.Sdk-amd64,i386-sniper-sysroot.tar.gz

View File

@ -1,4 +1,6 @@
#!/bin/sh -xe
#!/bin/sh
set -xeu
# Run this script from directory containing windows installer(s)
# passing needed version as argument