From 9ef3704ce8a8523c18c0e8366c1c144fefb6073b Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Mon, 24 Apr 2023 21:12:31 +0200 Subject: 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(). --- Meta/serenity.sh | 14 ++++++-------- 1 file 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 -- cgit v1.2.3