Meta: Use common method exit_if_running_as_root() in serenity.sh

This replaces the inline check for running as root with the common
method exit_if_running_as_root().
This commit is contained in:
Kenneth Myhra 2023-04-24 21:12:31 +02:00 committed by Andrew Kaster
parent b4a0fee03d
commit 9ef3704ce8
Notes: sideshowbarker 2024-07-17 00:23:42 +09:00

View File

@ -66,11 +66,6 @@ Usage: $NAME COMMAND [TARGET] [TOOLCHAIN] [ARGS...]
EOF
}
die() {
>&2 echo "die: $*"
exit 1
}
usage() {
>&2 print_help
exit 1
@ -84,9 +79,12 @@ if [ "$CMD" = "help" ]; then
exit 0
fi
if [ "$(id -u)" -eq 0 ]; then
die "Do not run serenity.sh as root, your Build directory will become root-owned"
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=/dev/null
. "${DIR}/shell_include.sh"
exit_if_running_as_root "Do not run serenity.sh as root, your Build directory will become root-owned"
if [ -n "$1" ]; then
TARGET="$1"; shift