From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Mon, 14 Apr 2025 08:30:53 +0000 (+0100) Subject: Check that the existing user startup script is replaceable. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffacecdce62a7a6cf24c8f2801f51bd5814f955e;p=thirdparty%2Fshairport-sync.git Check that the existing user startup script is replaceable. --- diff --git a/user-service-install.sh b/user-service-install.sh index 1d59f19e..4d09c937 100644 --- a/user-service-install.sh +++ b/user-service-install.sh @@ -117,6 +117,15 @@ if [ -d "$USER_SYSTEMD_DIR" ] && [ ! -w "$USER_SYSTEMD_DIR" ]; then exit 1 fi + +# If the service file already exists, check that we can replace it + +if [ -f "$SERVICE_DEST" ] && [ ! -w "$SERVICE_DEST" ]; then + echo "[FAIL] The existing $SERVICE_DEST can not be replaced due to its ownership or permissions." >&2 + echo " [ADVICE] Please delete $SERVICE_DEST or ensure it is owned and writable by user \"$(whoami)\" before proceeding." >&2 + exit 1 +fi + # Create the service file if [ "$DRY_RUN" -eq 0 ]; then