mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
|
||||
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
|
||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||
fi
|
||||
|
|
|
@ -8,7 +8,19 @@ die() {
|
|||
}
|
||||
|
||||
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
|
||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||
fi
|
||||
|
|
|
@ -17,7 +17,19 @@ if [ ! -d "limine" ]; then
|
|||
fi
|
||||
|
||||
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
|
||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||
fi
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -16,8 +16,19 @@ cleanup() {
|
|||
}
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
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
|
||||
else
|
||||
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue