summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-04-24 21:12:31 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2023-04-25 01:53:42 -0600
commit9ef3704ce8a8523c18c0e8366c1c144fefb6073b (patch)
tree47ee92ae779e908273f3b8a37d161a4880149c2e
parentb4a0fee03d00a4cbe5e2a6dfcd2937f51562f55a (diff)
downloadserenity-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-xMeta/serenity.sh14
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