From a81462e6176c92332990f449188b2e39f9b41440 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 5 May 2022 09:53:31 -0400 Subject: [PATCH] Build: Use writable location for temporary systemd unit file As set, the $SCRIPT_DIR was read-only (since the AppImage's squashfs is readonly). Use $PWD instead. --- .../appimage/install-infection-monkey-service.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_scripts/appimage/install-infection-monkey-service.sh b/build_scripts/appimage/install-infection-monkey-service.sh index aa434318b..b09bf2001 100755 --- a/build_scripts/appimage/install-infection-monkey-service.sh +++ b/build_scripts/appimage/install-infection-monkey-service.sh @@ -3,8 +3,8 @@ set -e SCRIPT_NAME="$(basename "${APPIMAGE}")" -SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" SYSTEMD_UNIT_FILENAME="infection-monkey.service" +TMP_SYSTEMD_UNIT="${PWD}/${SYSTEMD_UNIT_FILENAME}" SYSTEMD_DIR="/lib/systemd/system" MONKEY_BIN="/opt/infection-monkey/bin" APPIMAGE_NAME="InfectionMonkey.AppImage" @@ -25,9 +25,9 @@ echo_help() { install_service() { move_appimage - umask 077 - cat > "${SCRIPT_DIR}/${SYSTEMD_UNIT_FILENAME}" << EOF + umask 077 + cat > "${TMP_SYSTEMD_UNIT}" << EOF [Unit] Description=Infection Monkey Runner After=network.target @@ -41,7 +41,7 @@ ExecStart="${MONKEY_BIN}/${APPIMAGE_NAME}" WantedBy=multi-user.target EOF - sudo mv "${SCRIPT_DIR}/${SYSTEMD_UNIT_FILENAME}" "${SYSTEMD_DIR}/${SYSTEMD_UNIT_FILENAME}" + sudo mv "${TMP_SYSTEMD_UNIT}" "${SYSTEMD_DIR}/${SYSTEMD_UNIT_FILENAME}" sudo systemctl enable "${SYSTEMD_UNIT_FILENAME}" &>/dev/null echo -e "The Infection Monkey service has been installed and will start on boot.\n\