[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1064408: [PATCH] duplicate aliased diversions for DEP17



Package: live-build
Versrion: 1:20230502
User: helmutg@debian.org
Usertags: dep17p3
Tags: patch

/bin/hostname and /sbin/start-stop-daemon are being moved from / to /usr
in trixie. Hence, these diversions become ineffective. Temporarily add
both diversions to handle both variants.
---
 scripts/build/chroot_dpkg     | 15 ++++++++++++---
 scripts/build/chroot_hostname | 17 +++++++++++++----
 2 files changed, 25 insertions(+), 7 deletions(-)

I note that while live-build has MRs on salsa, I cannot seem to create
one. Hence sending a patch via bugs.d.o.

diff --git a/scripts/build/chroot_dpkg b/scripts/build/chroot_dpkg
index c43c0eb01..d64820f72 100755
--- a/scripts/build/chroot_dpkg
+++ b/scripts/build/chroot_dpkg
@@ -38,8 +38,14 @@ case "${_ACTION}" in
 		Acquire_lockfile
 
 		# Create custom start-stop-daemon program
-		Chroot chroot dpkg-divert --rename --quiet --add /sbin/start-stop-daemon
-		ln -fs /bin/true chroot/sbin/start-stop-daemon
+		Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/start-stop-daemon
+		# begin-remove-after: released:trixie
+		# In the bookworm to trixie upgrade, dpkg moves
+		# start-stop-daemon from /sbin to /usr/sbin. Duplicate the
+		# diversion to cover both. DEP17 P3 M18
+		Chroot chroot dpkg-divert --rename --quiet --add --divert /sbin/start-stop-daemon.distrib.usr-is-merged
+		# end-remove-after
+		ln -fs /bin/true chroot/usr/sbin/start-stop-daemon
 
 		# Disable dpkg syncing
 
@@ -79,8 +85,11 @@ EOF
 		Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel
 
 		# Remove custom start-stop-daemon program
-		rm -f chroot/sbin/start-stop-daemon
+		rm -f chroot/usr/sbin/start-stop-daemon
+		# begin-remove-after: released:trixie
 		Chroot chroot dpkg-divert --rename --quiet --remove /sbin/start-stop-daemon
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/start-stop-daemon
 
 		# Remove dpkg sync configuration
 		rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build
diff --git a/scripts/build/chroot_hostname b/scripts/build/chroot_hostname
index 836ce09bb..befe58f43 100755
--- a/scripts/build/chroot_hostname
+++ b/scripts/build/chroot_hostname
@@ -43,15 +43,21 @@ case "${_ACTION}" in
 		# Create custom hostname
 		Echo_message "Configuring file /bin/hostname"
 
-		Chroot chroot dpkg-divert --rename --quiet --add /bin/hostname
-
-cat > chroot/bin/hostname << EOF
+		Chroot chroot dpkg-divert --rename --quiet --add /usr/bin/hostname
+		# begin-remove-after: released:trixie
+		# In the bookworm to trixie upgrade, hostname moves hostname
+		# from /bin to /usr/bin. Duplicate the diversion to cover both.
+		# DEP17 P3 M18
+		Chroot chroot dpkg-divert --rename --quiet --add --divert /bin/hostname.distrib.usr-is-merged /bin/hostname
+		# end-remove-after
+
+cat > chroot/usr/bin/hostname << EOF
 #!/bin/sh
 
 echo "localhost.localdomain"
 EOF
 
-		chmod 755 chroot/bin/hostname
+		chmod 755 chroot/usr/bin/hostname
 
 		# Creating stage file
 		Create_stagefile
@@ -84,7 +90,10 @@ EOF
 
 		# Remove custom hostname
 		rm -f chroot/bin/hostname
+		# begin-remove-after: released:trixie
 		Chroot chroot dpkg-divert --rename --quiet --remove /bin/hostname
+		# end-remove-after
+		Chroot chroot dpkg-divert --rename --quiet --remove /usr/bin/hostname
 
 		# Removing stage file
 		Remove_stagefile
-- 
2.39.2


Reply to: