summaryrefslogtreecommitdiff
path: root/Meta/build-image-qemu.sh
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2020-06-20 05:20:50 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-21 10:13:04 +0200
commit8e24a17d0d7f6ebe5fe7b9e242ce8e696ceeacbf (patch)
tree5cef1ac4f9218d561f68db4311a04e9f2d5bacf9 /Meta/build-image-qemu.sh
parent22aa4cbf925117aa02e358a99e44ced24c88f34a (diff)
downloadserenity-8e24a17d0d7f6ebe5fe7b9e242ce8e696ceeacbf.zip
Meta: default SUDO_UID and SUDO_GID to 0 in build-image-*.sh scripts
In the GNU coreutils version of chown, ":" is a valid argument (the command will result in a no-op), but POSIX chown does not consider that valid. If the user who ran build-image-*.sh was root, SUDO_UID and SUDO_GID would not be set and, if the version of chown installed on the system did not allow passing just a ":" as argument, the script would fail. Let's default the value of SUDO_UID and SUDO_GID to 0 just in case.
Diffstat (limited to 'Meta/build-image-qemu.sh')
-rwxr-xr-xMeta/build-image-qemu.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh
index 578a56c4b1..86d6d271d6 100755
--- a/Meta/build-image-qemu.sh
+++ b/Meta/build-image-qemu.sh
@@ -9,6 +9,8 @@ die() {
if [ "$(id -u)" != 0 ]; then
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
+else
+ : "${SUDO_UID:=0}" "${SUDO_GID:=0}"
fi
if [ "$(uname -s)" = "Darwin" ]; then