From b06f782665bec1940bbf7db3e09da869ba608300 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 19 Apr 2022 14:07:43 -0400 Subject: [PATCH] install: add flag to disable systemctl The "-z" flag will run the install script without running the systemctl command. This is useful for installations which are done outside of the normal "boot" process. Signed-off-by: Eric Callahan --- scripts/install-moonraker.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/install-moonraker.sh b/scripts/install-moonraker.sh index d659b3d..4b1c827 100755 --- a/scripts/install-moonraker.sh +++ b/scripts/install-moonraker.sh @@ -6,6 +6,7 @@ PYTHONDIR="${HOME}/moonraker-env" SYSTEMDDIR="/etc/systemd/system" REBUILD_ENV="n" FORCE_DEFAULTS="n" +DISABLE_SYSTEMCTL="n" CONFIG_PATH="${HOME}/moonraker.conf" LOG_PATH="/tmp/moonraker.log" @@ -89,8 +90,10 @@ Restart=always RestartSec=10 EOF # Use systemctl to enable the klipper systemd service script - sudo systemctl enable moonraker.service - sudo systemctl daemon-reload + if [ $DISABLE_SYSTEMCTL = "n" ]; then + sudo systemctl enable moonraker.service + sudo systemctl daemon-reload + fi } check_polkit_rules() @@ -149,10 +152,11 @@ SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" LAUNCH_CMD="${PYTHONDIR}/bin/python ${SRCDIR}/moonraker/moonraker.py" # Parse command line arguments -while getopts "rfc:l:" arg; do +while getopts "rfzc:l:" arg; do case $arg in r) REBUILD_ENV="y";; f) FORCE_DEFAULTS="y";; + z) DISABLE_SYSTEMCTL="y";; c) CONFIG_PATH=$OPTARG;; l) LOG_PATH=$OPTARG;; esac @@ -165,4 +169,6 @@ install_packages create_virtualenv install_script check_polkit_rules -start_software +if [ $DISABLE_SYSTEMCTL = "n" ]; then + start_software +fi