1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

Meta: Don't tell to run script as root when that's not the actual error

Before, and that was the cause of many confusion in #build-problems
on Discord, the Meta/build-image-*.sh scripts would error out with
the message "this script needs to run as root" while the actual error
was unrelated.
This commit is contained in:
demostanis 2022-09-03 12:54:05 +02:00 committed by Linus Groh
parent d007337d97
commit 48aea321c5
5 changed files with 65 additions and 7 deletions

View file

@ -31,8 +31,19 @@ if [ "$(id -u)" != 0 ]; then
if [ -x "$FUSE2FS_PATH" ] && $FUSE2FS_PATH --help 2>&1 |grep fakeroot > /dev/null; then
USE_FUSE2FS=1
else
${SUDO} -E -- "$0" "$@" || die "this script needs to run as root"
exit 0
set +e
${SUDO} -E -- sh -c "\"$0\" $* || exit 42"
case $? in
1)
die "this script needs to run as root"
;;
42)
exit 1
;;
*)
exit 0
;;
esac
fi
else
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"