diff options
author | Emanuele Torre <torreemanuele6@gmail.com> | 2020-06-20 05:20:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-21 10:13:04 +0200 |
commit | 8e24a17d0d7f6ebe5fe7b9e242ce8e696ceeacbf (patch) | |
tree | 5cef1ac4f9218d561f68db4311a04e9f2d5bacf9 /Meta/build-image-grub.sh | |
parent | 22aa4cbf925117aa02e358a99e44ced24c88f34a (diff) | |
download | serenity-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-grub.sh')
-rwxr-xr-x | Meta/build-image-grub.sh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Meta/build-image-grub.sh b/Meta/build-image-grub.sh index 6c1a428d24..fff4f64eb5 100755 --- a/Meta/build-image-grub.sh +++ b/Meta/build-image-grub.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 grub=$(command -v grub-install 2>/dev/null) || true |