From febad65ff924eadeee9ff21f485c79247385d81e Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 29 Apr 2021 15:40:38 -0400 Subject: [PATCH] appimage: Perform root checks after parsing args --- appimage/build_appimage.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/appimage/build_appimage.sh b/appimage/build_appimage.sh index 9358a12be..f368ac7ea 100755 --- a/appimage/build_appimage.sh +++ b/appimage/build_appimage.sh @@ -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