forked from p15670423/monkey
Build: Switch order of user_exists() and exit_if_user_doesnt_exist()
This commit is contained in:
parent
d5bb94f1a8
commit
fc96e3aced
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue