appimage: Perform root checks after parsing args

This commit is contained in:
Mike Salvatore 2021-04-29 15:40:38 -04:00
parent d53ba0e881
commit febad65ff9
1 changed files with 11 additions and 11 deletions

View File

@ -287,17 +287,6 @@ apply_version_to_appimage() {
mv "Infection_Monkey-x86_64.AppImage" "Infection_Monkey-$1-x86_64.AppImage"
}
if is_root; then
log_message "Please don't run this script as root"
exit 1
fi
if ! has_sudo; then
log_message "You need root permissions for some of this script operations. \
Run \`sudo -v\`, enter your password, and then re-run this script."
exit 1
fi
monkey_repo="$DEFAULT_REPO_MONKEY_HOME"
monkey_version="dev"
agent_binary_dir=""
@ -347,6 +336,17 @@ case "$1" in
esac
done
if is_root; then
log_message "Please don't run this script as root"
exit 1
fi
if ! has_sudo; then
log_message "You need root permissions for some of this script operations. \
Run \`sudo -v\`, enter your password, and then re-run this script."
exit 1
fi
install_build_prereqs
install_appimage_tool