This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=7c961df91bb81f27657cdca31d761b86140e9a76

commit 7c961df91bb81f27657cdca31d761b86140e9a76
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Jan 4 20:15:44 2024 +0100

    debian: Install s-s-d under /usr/sbin
    
    On systems that have a merged-/usr this makes sure to install the
    program in its canonical location on disk. On derivatives that do not
    use a merged-/usr layout we create backward compatibility symlinks,
    which can be removed once there are no more references to the absolute
    pathname or the one under /sbin.
    
    This makes it possible to remove the special casing for s-s-d and its
    destination on install.
    
    Closes: #1059982
---
 debian/dpkg.install        |  4 ++--
 debian/dpkg.postinst       | 12 ++++++++++++
 debian/dpkg.postrm         | 10 ++++++++++
 debian/rules               |  1 -
 debian/tests/test-not-root |  1 -
 debian/tests/test-root     |  1 -
 6 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/debian/dpkg.install b/debian/dpkg.install
index 907419f7b..0063a81fb 100644
--- a/debian/dpkg.install
+++ b/debian/dpkg.install
@@ -2,8 +2,6 @@ debian/dpkg.cfg etc/dpkg
 
 etc/dpkg/dpkg.cfg.d
 etc/alternatives
-sbin/dpkg-fsys-usrunmess usr/sbin/
-sbin/start-stop-daemon
 usr/bin/dpkg
 usr/bin/dpkg-deb
 usr/bin/dpkg-divert
@@ -16,6 +14,8 @@ usr/bin/dpkg-trigger
 usr/bin/update-alternatives
 usr/lib/dpkg/dpkg-db-backup usr/libexec/dpkg/
 usr/lib/dpkg/dpkg-db-keeper usr/libexec/dpkg/
+usr/sbin/dpkg-fsys-usrunmess
+usr/sbin/start-stop-daemon
 usr/share/dpkg/*table
 usr/share/dpkg/sh/dpkg-error.sh
 usr/share/lintian/profiles
diff --git a/debian/dpkg.postinst b/debian/dpkg.postinst
index 3d8a74133..7ba5961a0 100644
--- a/debian/dpkg.postinst
+++ b/debian/dpkg.postinst
@@ -51,9 +51,21 @@ check_merged_usr_via_aliased_dirs()
   done
 }
 
+setup_aliases()
+{
+  local prog=start-stop-daemon
+
+  # Add a backward compatibility symlink alias for s-s-d, which is now
+  # installed in its canonical location.
+  if [ ! -f "$DPKG_ROOT/sbin/$prog" ]; then
+    ln -s "/usr/sbin/$prog" "$DPKG_ROOT/sbin/$prog"
+  fi
+}
+
 case "$1" in
 configure)
   check_merged_usr_via_aliased_dirs
+  setup_aliases
   ;;
 abort-upgrade|abort-deconfigure|abort-remove)
   ;;
diff --git a/debian/dpkg.postrm b/debian/dpkg.postrm
index 72c4ed380..599ffe368 100644
--- a/debian/dpkg.postrm
+++ b/debian/dpkg.postrm
@@ -11,6 +11,15 @@ remove_logfile() {
   rm -f "$logdir"/alternatives.log "$logdir"/alternatives.log.* 2>/dev/null
 }
 
+# Remove backward compatibility symlink alias when dpkg is removed.
+remove_aliases() {
+  local prog=start-stop-daemon
+
+  if [ -L "$DPKG_ROOT/sbin/$prog" ]; then
+    rm "$DPKG_ROOT/sbin/$prog"
+  fi
+}
+
 # Version 1.22.0 stopped the systemd timer, which meant it would not run
 # anymore.
 fixup_systemd_timer() {
@@ -21,6 +30,7 @@ fixup_systemd_timer() {
 
 case "$1" in
 remove)
+  remove_aliases
   ;;
 purge)
   remove_logfile
diff --git a/debian/rules b/debian/rules
index 2a85fd1c3..5a391f5cd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -47,7 +47,6 @@ override_dh_auto_configure:
        dh_auto_configure -- \
                $(confflags) \
                $(shell $(dpkg_buildflags) --export=configure) \
-               --sbindir=/sbin \
                --libexecdir=\$${exec_prefix}/lib \
                --with-devlibdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
                --with-libz \
diff --git a/debian/tests/test-not-root b/debian/tests/test-not-root
index cf6db127b..7438d70b3 100644
--- a/debian/tests/test-not-root
+++ b/debian/tests/test-not-root
@@ -14,7 +14,6 @@ cd $AUTOPKGTEST_TMP
   --disable-nls \
   --disable-dselect \
   --prefix=/usr \
-  --sbindir=/sbin \
   --libexecdir='${exec_prefix}/lib' \
   --sysconfdir=/etc \
   --localstatedir=/var \
diff --git a/debian/tests/test-root b/debian/tests/test-root
index b5647061d..f09da154b 100644
--- a/debian/tests/test-root
+++ b/debian/tests/test-root
@@ -14,7 +14,6 @@ cd $AUTOPKGTEST_TMP
   --disable-nls \
   --disable-dselect \
   --prefix=/usr \
-  --sbindir=/sbin \
   --libexecdir='${exec_prefix}/lib' \
   --sysconfdir=/etc \
   --localstatedir=/var \

-- 
Dpkg.Org's dpkg

Reply via email to