diff --git a/README.md b/README.md index 6f1fd4c..bc69c75 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,8 @@ padcontroller/systemd/install.sh ``` Options after the command go to the pad controller (for example `--lock-knobs`). -`--uninstall` removes the service. Logs: `journalctl --user -u padcontroller -f`. +`--no-enable` installs it without starting it at login (start it with +`systemctl --user start padcontroller`). `--uninstall` removes the service. Logs: `journalctl --user -u padcontroller -f`. ## Chataigne diff --git a/padcontroller/systemd/install.sh b/padcontroller/systemd/install.sh index 063973b..d1a4446 100755 --- a/padcontroller/systemd/install.sh +++ b/padcontroller/systemd/install.sh @@ -3,6 +3,8 @@ # # padcontroller/systemd/install.sh # install, enable, start # padcontroller/systemd/install.sh --lock-knobs # pass options to the pad controller +# padcontroller/systemd/install.sh --no-enable # install only; start it with +# # systemctl --user start padcontroller # padcontroller/systemd/install.sh --uninstall # # Logs: journalctl --user -u padcontroller -f @@ -28,12 +30,25 @@ PYTHON="$ROOT/.venv/bin/python" exit 1 } +ENABLE=1 +if [[ "${1:-}" == "--no-enable" ]]; then + ENABLE= + shift +fi + ARGS="$*" mkdir -p "$DEST" sed -e "s|@ROOT@|$ROOT|g" -e "s|@PYTHON@|$PYTHON|g" -e "s|@ARGS@|$ARGS|g" \ "$HERE/$UNIT" >"$DEST/$UNIT" systemctl --user daemon-reload +if [[ -z "$ENABLE" ]]; then + # Undo an earlier enable, so it does not start at login here. + systemctl --user disable "$UNIT" 2>/dev/null || true + echo "Installed $DEST/$UNIT. It does not start at login." + echo "Start it with: systemctl --user start padcontroller" + exit 0 +fi systemctl --user enable "$UNIT" systemctl --user restart "$UNIT" echo "Installed $DEST/$UNIT and started it."