Moved root check to before case statement

We can have code in the case statement, so no need to run that, if we were supposed to exit.
This commit is contained in:
Søren Theilgaard
2021-11-23 08:59:44 +01:00
parent 7d59b37bf3
commit 2a15a2142d
2 changed files with 5 additions and 5 deletions

View File

@@ -46,6 +46,11 @@ versionKey="CFBundleShortVersionString"
# get current user
currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }')
# MARK: check for root
if [[ "$(whoami)" != "root" && "$DEBUG" -ne 2 ]]; then
# not running as root
cleanupAndExit 6 "not running as root, exiting"
fi
# MARK: labels in case statement
case $label in

View File

@@ -5,11 +5,6 @@
;;
esac
# MARK: check for root
if [[ "$(whoami)" != "root" && "$DEBUG" -ne 2 ]]; then
# not running as root
cleanupAndExit 6 "not running as root, exiting"
fi
# MARK: application download and installation starts here