Package: fair
Version: 0.5.3-3
Severity: important
Tags: patch
X-Debbugs-Cc: наб <nabijaczlew...@nabijaczleweli.xyz>, ti...@debian.org

Hi,

your latest upload of fair added native systemd service units.
Thanks for that!

Unfortunately, it uses an anti-pattern that should not be used, i.e.
ENABLE/DISABLE flags in /etc/default/$package which are then processed
by shell, in case of fair debian/fair.default contains:

CARROUSEL=false
TRANSPONDER=false

and the corresponding .service units have

ExecStart=/bin/sh -c 'if $CARROUSEL; then exec /usr/sbin/carrousel; fi'


Please don't do that. The benefit of having one service unit per service
is, that they can be enabled/disabled via systemctl enable/disable. By
introducing another mechanism to enable/disable a service, the end
result is inconsistent behaviour for the user.

A better way is to deprecate/remove the usage of CARROUSEL and
TRANSPONDER from the systemd service units and start the binaries
directly i.e.

ExecStart=/usr/sbin/carrousel
and
ExecStart=/usr/sbin/transponder $BALANCERS

As the default is to have the services disabled upon installation
use dh_installsystemd's --no-enable switch.

The attached patch tries to address this.

Michael
diff -Nru fair-0.5.3/debian/changelog fair-0.5.3/debian/changelog
--- fair-0.5.3/debian/changelog 2024-10-05 22:14:34.000000000 +0200
+++ fair-0.5.3/debian/changelog 2024-10-09 18:21:15.000000000 +0200
@@ -1,3 +1,11 @@
+fair (0.5.3-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Deprecate usage of fair.default for enabling fair-carrousel.service and
+    fair-transponder.service.
+
+ -- Michael Biebl <bi...@debian.org>  Wed, 09 Oct 2024 18:21:15 +0200
+
 fair (0.5.3-3) unstable; urgency=medium
 
   [ Andreas Tille ]
diff -Nru fair-0.5.3/debian/fair.default fair-0.5.3/debian/fair.default
--- fair-0.5.3/debian/fair.default      2024-10-05 21:03:46.000000000 +0200
+++ fair-0.5.3/debian/fair.default      2024-10-09 18:21:15.000000000 +0200
@@ -1,6 +1,10 @@
 # $Id: fair.default 8058 2005-07-07 13:06:53Z guus $
 # $URL: 
https://infix.uvt.nl/its-id/trunk/sources/fair/package/debian/fair.default $
 
+# The following two parameters are only relevant for SysV init.
+# When running systemd, please use systemctl enable fair-carrousel.service or
+# systemctl enable fair-transponder.service to enable those services.
 CARROUSEL=false
 TRANSPONDER=false
+
 BALANCERS=
diff -Nru fair-0.5.3/debian/fair.fair-carrousel.service 
fair-0.5.3/debian/fair.fair-carrousel.service
--- fair-0.5.3/debian/fair.fair-carrousel.service       2024-10-05 
21:47:43.000000000 +0200
+++ fair-0.5.3/debian/fair.fair-carrousel.service       2024-10-09 
17:54:24.000000000 +0200
@@ -7,8 +7,7 @@
 
 [Service]
 Type=forking
-EnvironmentFile=/etc/default/fair
-ExecStart=/bin/sh -c 'if $CARROUSEL; then exec /usr/sbin/carrousel; fi'
+ExecStart=/usr/sbin/carrousel
 
 [Install]
 WantedBy=multi-user.target
diff -Nru fair-0.5.3/debian/fair.fair-transponder.service 
fair-0.5.3/debian/fair.fair-transponder.service
--- fair-0.5.3/debian/fair.fair-transponder.service     2024-10-05 
21:48:25.000000000 +0200
+++ fair-0.5.3/debian/fair.fair-transponder.service     2024-10-09 
17:55:27.000000000 +0200
@@ -8,7 +8,7 @@
 [Service]
 Type=forking
 EnvironmentFile=/etc/default/fair
-ExecStart=/bin/sh -c 'if $TRANSPONDER; then exec /usr/sbin/transponder -- 
"$@"; fi' _ $BALANCERS
+ExecStart=/usr/sbin/transponder $BALANCERS
 
 [Install]
 WantedBy=multi-user.target
diff -Nru fair-0.5.3/debian/rules fair-0.5.3/debian/rules
--- fair-0.5.3/debian/rules     2024-10-05 21:56:33.000000000 +0200
+++ fair-0.5.3/debian/rules     2024-10-09 18:21:15.000000000 +0200
@@ -6,8 +6,8 @@
        dh $@
 
 override_dh_installsystemd:
-       dh_installsystemd --name fair-carrousel
-       dh_installsystemd --name fair-transponder
+       dh_installsystemd --name fair-carrousel --no-enable
+       dh_installsystemd --name fair-transponder --no-enable
 
 override_dh_auto_install:
        dh_auto_install

Reply via email to