Package: rpcbind
Version: 1.2.6-6
Severity: normal
Tags: patch
User: helm...@debian.org
Usertags: dep17m2

We want to modify dh_installsystemd such that it installs units below
/usr in order to finalize the /usr-merge transition via DEP17. When
doing so, the rpcbind units get installed twice. They're first installed
to /lib (via dh_auto_install) and then also installed to /usr/lib (via
dh_installsystemd) and these even differ. Doing so is a policy
violation, so this bug will become release-critical once I upload
debhelper. I'm attaching a patch that explicitly deletes the upstream
units and also makes the portmap.service link adapt to where
dh_installsystemd chooses to place units.

Helmut
diff -Nru rpcbind-1.2.6/debian/changelog rpcbind-1.2.6/debian/changelog
--- rpcbind-1.2.6/debian/changelog      2022-07-27 11:20:27.000000000 +0200
+++ rpcbind-1.2.6/debian/changelog      2023-10-24 11:52:18.000000000 +0200
@@ -1,3 +1,10 @@
+rpcbind (1.2.6-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Install systemd units only once. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 24 Oct 2023 11:52:18 +0200
+
 rpcbind (1.2.6-6) unstable; urgency=medium
 
   * Add missing postinst script creating _rpc user (Closes: #1016064)
diff -Nru rpcbind-1.2.6/debian/rules rpcbind-1.2.6/debian/rules
--- rpcbind-1.2.6/debian/rules  2022-07-27 11:20:27.000000000 +0200
+++ rpcbind-1.2.6/debian/rules  2023-10-24 11:52:18.000000000 +0200
@@ -7,7 +7,8 @@
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 ifeq (linux,$(DEB_HOST_ARCH_OS))
-       CONFIGURE_EXTRA_FLAGS += --with-systemdsystemunitdir=/lib/systemd/system
+       # Setting no would also disable support in the rpcbind executable.
+       CONFIGURE_EXTRA_FLAGS += --with-systemdsystemunitdir=/unused
 else
        CONFIGURE_EXTRA_FLAGS += --with-systemdsystemunitdir=no
 endif
@@ -18,6 +19,9 @@
 override_dh_auto_configure:
        dh_auto_configure -- --sbindir=/sbin --enable-warmstarts 
--enable-libwrap --with-statedir=/run/rpcbind --with-rpcuser=_rpc 
--enable-debug $(CONFIGURE_EXTRA_FLAGS)
 
+execute_after_dh_auto_install:
+       rm -Rf debian/rpcbind/unused
+
 override_dh_installinit:
        dh_installinit
        install -d debian/rpcbind/etc/insserv.conf.d
@@ -27,7 +31,6 @@
        dh_installsystemd --no-restart-after-upgrade
 
 ifeq (linux,$(DEB_HOST_ARCH_OS))
-override_dh_link:
-       dh_link lib/systemd/system/rpcbind.service 
lib/systemd/system/portmap.service
-       dh_link
+execute_before_dh_link:
+       dh_link $$(test -d debian/rpcbind/usr/lib/systemd && echo 
usr/)lib/systemd/system/rpcbind.service $$(test -d 
debian/rpcbind/usr/lib/systemd && echo usr/)lib/systemd/system/portmap.service
 endif

Reply via email to