Build: Switch order of user_exists() and exit_if_user_doesnt_exist()

This commit is contained in:
Mike Salvatore 2022-05-05 10:44:07 -04:00
parent d5bb94f1a8
commit fc96e3aced
1 changed files with 4 additions and 4 deletions

View File

@ -83,16 +83,16 @@ uninstall_service() {
echo "The Infection Monkey service has been uninstalled" echo "The Infection Monkey service has been uninstalled"
} }
user_exists() {
id -u "$1" &>/dev/null
}
exit_if_user_doesnt_exist() { exit_if_user_doesnt_exist() {
if ! user_exists "$1" ; then if ! user_exists "$1" ; then
die "Error: User '$1' does not exist." die "Error: User '$1' does not exist."
fi fi
} }
user_exists() {
id -u "$1" &>/dev/null
}
has_sudo() { has_sudo() {
# 0 true, 1 false # 0 true, 1 false
sudo -nv > /dev/null 2>&1 sudo -nv > /dev/null 2>&1