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 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