summaryrefslogtreecommitdiff
path: root/Meta/build-image-limine.sh
diff options
context:
space:
mode:
authordemostanis <demostanis@protonmail.com>2022-09-03 12:54:05 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-15 01:40:01 +0200
commit48aea321c5e26f1fd71ad5c1dd7ae6be7313d3b6 (patch)
tree11ca673853ba0098cb15285f38978d292e8e9eb5 /Meta/build-image-limine.sh
parentd007337d97189facc8ad1b661ceabf06bfe7e5bc (diff)
downloadserenity-48aea321c5e26f1fd71ad5c1dd7ae6be7313d3b6.zip
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.
Diffstat (limited to 'Meta/build-image-limine.sh')
-rwxr-xr-xMeta/build-image-limine.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/Meta/build-image-limine.sh b/Meta/build-image-limine.sh
index 0760ed7772..c84330323a 100755
--- a/Meta/build-image-limine.sh
+++ b/Meta/build-image-limine.sh
@@ -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