appimage: Add --as-root flag

This commit is contained in:
Mike Salvatore 2021-04-30 07:36:18 -04:00
parent febad65ff9
commit ebd2fddd79
1 changed files with 10 additions and 2 deletions

View File

@ -36,6 +36,9 @@ echo_help() {
echo " parameter is unspecified, the latest release"
echo " binaries will be downloaded from GitHub."
echo ""
echo "--as-root Throw caution to the wind and allow this script"
echo " to be run as root."
echo ""
echo "--branch The git branch you'd like the AppImage to be"
echo " built from. (Default: develop)"
echo ""
@ -287,6 +290,7 @@ apply_version_to_appimage() {
mv "Infection_Monkey-x86_64.AppImage" "Infection_Monkey-$1-x86_64.AppImage"
}
as_root=false
monkey_repo="$DEFAULT_REPO_MONKEY_HOME"
monkey_version="dev"
agent_binary_dir=""
@ -302,6 +306,10 @@ case "$1" in
missing_argument "$1"
fi
;;
--as-root)
as_root=true
shift
;;
--branch)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
branch=$2
@ -336,7 +344,7 @@ case "$1" in
esac
done
if is_root; then
if ! $as_root && is_root; then
log_message "Please don't run this script as root"
exit 1
fi