Package: debhelper Version: 13.11.1 Severity: wishlist
Currently the `--no-enable` and `--no-start` options can be passed to `dh_installinit` and `dh_installsystemd` to control whether a daemon is enabled or started during `postinst`. For my use case, this is not flexible enough; I want to be able to decide whether to enable/start the service after debconf has collected answers from the user. Details of my use case: I maintain ddclient, which can be used either as a daemon or single shot via a hook (e.g., `/etc/ppp/ip-up.d/ddclient` or `/etc/dhcp/dhclient-exit-hooks.d/ddclient`). debconf asks the user how they would like to run ddclient, and `postinst` enables the daemon depending on the answer. Because `dh_installinit` and `dh_installsystemd` currently require the decision to be made at package build time, I have some ugly hacks in place to make it work: https://salsa.debian.org/debian/ddclient/-/blob/f701932aa76bbedc5d1765786eff9653b6d0e212/debian/postinst#L118-169 https://salsa.debian.org/debian/ddclient/-/blob/f701932aa76bbedc5d1765786eff9653b6d0e212/debian/prerm#L12-26 https://salsa.debian.org/debian/ddclient/-/blob/f701932aa76bbedc5d1765786eff9653b6d0e212/debian/control#L27-33 https://salsa.debian.org/debian/ddclient/-/blob/f701932aa76bbedc5d1765786eff9653b6d0e212/debian/ddclient.lintian-overrides The need to maintain the hacks have resulted in minor bugs, for example: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022810 If the decision to enable/start the service could be delayed to `postinst`, then I could remove the hacks. Possible solution: * Add an `--enable=func` option to `dh_installinit` and `dh_installsystemd`. The code generated for the `#DEBHELPER#` magic comment in `postinst` would then use the return value of `func` to control whether the service is enabled. `func` would default to `true` unless `--no-enable` was passed, in which case it would default to `false`. * Similarly, add a `--start=func` option that controls whether the service is started. * Add `--stop=func` for `prerm` that controls whether the service is stopped when the package is removed. (Even better: Unconditionally stop the service when the package is removed even if `--no-start` is passed.) -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 5.15.0-41-generic (SMP w/8 CPU threads) Kernel taint flags: TAINT_WARN, TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: unable to detect Versions of packages debhelper depends on: ii autotools-dev 20220109.1 ii dh-autoreconf 20 ii dh-strip-nondeterminism 1.13.0-1 ii dpkg 1.21.9+b1 ii dpkg-dev 1.21.9 ii dwz 0.14+20220924-2 ii file 1:5.41-4 ii libdebhelper-perl 13.11.1 ii libdpkg-perl 1.21.9 ii man-db 2.11.1-1 ii perl 5.36.0-4 ii po-debconf 1.0.21+nmu1 debhelper recommends no packages. Versions of packages debhelper suggests: ii dh-make 2.202204 -- no debconf information
OpenPGP_signature
Description: OpenPGP digital signature