diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-04-24 21:12:31 +0200 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-04-25 01:53:42 -0600 |
commit | 9ef3704ce8a8523c18c0e8366c1c144fefb6073b (patch) | |
tree | 47ee92ae779e908273f3b8a37d161a4880149c2e | |
parent | b4a0fee03d00a4cbe5e2a6dfcd2937f51562f55a (diff) | |
download | serenity-9ef3704ce8a8523c18c0e8366c1c144fefb6073b.zip |
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().
-rwxr-xr-x | Meta/serenity.sh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Meta/serenity.sh b/Meta/serenity.sh index 68798121b9..578206a7a6 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -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 |