diff --git a/appimage/README.md b/appimage/README.md index 95ff4d42d..dfa4731a0 100644 --- a/appimage/README.md +++ b/appimage/README.md @@ -20,7 +20,7 @@ remove build artifacts by removing the following files and directories. - $HOME/.monkey_island (optional) - $HOME/appimage/squashfs-root - $HOME/git/monkey -- $HOME/appimage/Infection_Monkey-x86_64.AppImage +- $HOME/appimage/Infection_Monkey*x86_64.AppImage After removing the above files and directories, you can again execute `bash build_appimage.sh`. diff --git a/appimage/build_appimage.sh b/appimage/build_appimage.sh index 9a3d56de3..dcda9ddb0 100755 --- a/appimage/build_appimage.sh +++ b/appimage/build_appimage.sh @@ -220,6 +220,11 @@ add_apprun() { build_appimage() { log_message "Building AppImage" ARCH="x86_64" appimagetool "$APPDIR" + apply_version_to_appimage "$1" +} + +apply_version_to_appimage() { + mv "Infection_Monkey-x86_64.AppImage" "Infection_Monkey-$1-x86_64.AppImage" } if is_root; then @@ -233,6 +238,21 @@ Run \`sudo -v\`, enter your password, and then re-run this script." exit 1 fi +monkey_version="dev" + +while (( "$#" )); do +case "$1" in + --version) + if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then + monkey_version=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + esac +done + install_build_prereqs install_appimage_tool @@ -241,7 +261,7 @@ clone_monkey_repo "$@" setup_appdir -build_appimage +build_appimage "$monkey_version" log_message "Deployment script finished." exit 0 diff --git a/appimage/clean.sh b/appimage/clean.sh index 5e2fd443a..f48837d37 100755 --- a/appimage/clean.sh +++ b/appimage/clean.sh @@ -6,4 +6,4 @@ rm -rf "$HOME/.monkey_island" rm -rf "$HOME/appimage/squashfs-root" rm -rf "$HOME/git/monkey" -rm "$HOME/appimage/Infection_Monkey-x86_64.AppImage" +rm $HOME/appimage/Infection_Monkey*x86_64.AppImage