Package: sslh Version: 1.20-1 Severity: normal Dear Maintainer,
I'm attaching a couple of *untested* patches that should improve the package prerm maintainer script. The patch headers should explain what their purpose is. I'm also including the prerm from the binary package below for your convenience so you can see that stop is done twice (on systemd systems). ---------------------8<----->8------------------------------------- #!/bin/sh set -e case "$1" in remove|upgrade|purge) # if sslh is running, stop it before removing if pidof sslh >/dev/null 2>&1; then # test if invoke-rc.d command is present on this system if command -v invoke-rc.d >/dev/null 2>&1; then invoke-rc.d sslh stop # if really not, use initscript else /etc/init.d/sslh stop fi fi ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installsystemd/12.6.1 if [ -d /run/systemd/system ] && [ "$1" = remove ]; then deb-systemd-invoke stop 'sslh.service' >/dev/null || true fi # End automatically added section exit 0 ---------------------8<----->8------------------------------------- Regards, Andreas Henriksson
>From 44f17216824a2dd117b1cb13776825ce155b08b1 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andr...@fatal.se> Date: Sun, 25 Sep 2022 19:41:31 +0200 Subject: [PATCH 1/2] Always use invoke-rc.d when stopping on remove Rely on the 'status' argument in init script / systemd service to check for running service (rather than open-coding it using pidof). While at it also simplify commands since (Debian Policy mandated helper) invoke-rc.d is part of Essential and should always be available on all supported systems. --- debian/prerm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/debian/prerm b/debian/prerm index ee6f19b..f144910 100644 --- a/debian/prerm +++ b/debian/prerm @@ -4,14 +4,8 @@ set -e case "$1" in remove|upgrade|purge) # if sslh is running, stop it before removing - if pidof sslh >/dev/null 2>&1; then - # test if invoke-rc.d command is present on this system - if command -v invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d sslh stop - # if really not, use initscript - else - /etc/init.d/sslh stop - fi + if invoke-rc.d --quiet sslh status > /dev/null 2>&1 ; then + invoke-rc.d sslh stop fi ;; -- 2.30.2
>From 10e914affc8ee5797a23e732158d0ec7272c3a06 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andr...@fatal.se> Date: Sun, 25 Sep 2022 19:45:06 +0200 Subject: [PATCH 2/2] Treat systemd services same as init scripts The package is already using dh compat 12, which means systemd services are installed via the dh_installsystemd rather than dh_installinit (as used to happen in some ancient dh compat level?). This seems to have been missed when upgrading the compat. This for example avoids prerm to try to stop the service *twice* when using systemd. (Since #DEBHELPER# was expanded to a second stop on top of the manually added stop command.) --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index c3cf9cc..ad11b3d 100755 --- a/debian/rules +++ b/debian/rules @@ -21,6 +21,8 @@ override_dh_auto_install: # do not start daemon by default: force user to configure override_dh_installinit: dh_installinit --no-start --no-enable +override_dh_installsystemd: + dh_installsystemd --no-start --no-enable %: dh $@ -- 2.30.2