mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +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:
parent
d007337d97
commit
48aea321c5
Notes:
sideshowbarker
2024-07-17 05:46:54 +09:00
Author: https://github.com/demostanis Commit: https://github.com/SerenityOS/serenity/commit/48aea321c5 Pull-request: https://github.com/SerenityOS/serenity/pull/15119 Reviewed-by: https://github.com/timschumi ✅
5 changed files with 65 additions and 7 deletions
|
@ -8,7 +8,19 @@ die() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
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
|
||||||
else
|
else
|
||||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -8,7 +8,19 @@ die() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
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
|
||||||
else
|
else
|
||||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -17,7 +17,19 @@ if [ ! -d "limine" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
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
|
||||||
else
|
else
|
||||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -31,8 +31,19 @@ if [ "$(id -u)" != 0 ]; then
|
||||||
if [ -x "$FUSE2FS_PATH" ] && $FUSE2FS_PATH --help 2>&1 |grep fakeroot > /dev/null; then
|
if [ -x "$FUSE2FS_PATH" ] && $FUSE2FS_PATH --help 2>&1 |grep fakeroot > /dev/null; then
|
||||||
USE_FUSE2FS=1
|
USE_FUSE2FS=1
|
||||||
else
|
else
|
||||||
${SUDO} -E -- "$0" "$@" || die "this script needs to run as root"
|
set +e
|
||||||
exit 0
|
${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
|
fi
|
||||||
else
|
else
|
||||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
|
|
|
@ -16,8 +16,19 @@ cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
sudo -E -- "$0" "$@" || die "this script needs to run as root"
|
set +e
|
||||||
exit 0
|
${SUDO} -E -- sh -c "\"$0\" $* || exit 42"
|
||||||
|
case $? in
|
||||||
|
1)
|
||||||
|
die "this script needs to run as root"
|
||||||
|
;;
|
||||||
|
42)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue