Build: Extract function install_systemd_unit()

This commit is contained in:
Mike Salvatore 2022-05-05 09:59:45 -04:00
parent a81462e617
commit 88eb9dbe81
1 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,14 @@ echo_help() {
install_service() {
move_appimage
install_systemd_unit "$1"
echo -e "The Infection Monkey service has been installed and will start on boot.\n\
Run 'systemctl start infection-monkey' to start the service now."
}
install_systemd_unit() {
umask 077
cat > "${TMP_SYSTEMD_UNIT}" << EOF
[Unit]
@ -43,9 +50,6 @@ EOF
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\
Run 'systemctl start infection-monkey' to start the service now."
}
uninstall_service() {