mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
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.
This commit is contained in:
parent
22aa4cbf92
commit
8e24a17d0d
2 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,8 @@ die() {
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
||||||
|
else
|
||||||
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grub=$(command -v grub-install 2>/dev/null) || true
|
grub=$(command -v grub-install 2>/dev/null) || true
|
||||||
|
|
|
@ -9,6 +9,8 @@ die() {
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
||||||
|
else
|
||||||
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue