From 4d72f617d92ec9147fbbd926cdcccbfc2557a3e6 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 25 Jan 2024 09:30:26 +0100 Subject: [PATCH] dpkg 1.22.3 moved start-stop-daemon from /sbin to /usr/sbin, see #1059982 --- mmdebstrap | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index fc74da8..4a28562 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1551,32 +1551,34 @@ sub setup_mounts { if (any { $_ eq 'chroot/start-stop-daemon' } @{ $options->{skip} }) { info "skipping chroot/start-stop-daemon as requested"; } else { + my $ssdloc; + if (-f "$options->{root}/sbin/start-stop-daemon") { + $ssdloc = "$options->{root}/sbin/start-stop-daemon"; + } elsif (-f "$options->{root}/usr/sbin/start-stop-daemon") { + $ssdloc = "$options->{root}/usr/sbin/start-stop-daemon"; + } push @cleanup_tasks, sub { - if (-e "$options->{root}/sbin/start-stop-daemon.REAL") { - move( - "$options->{root}/sbin/start-stop-daemon.REAL", - "$options->{root}/sbin/start-stop-daemon" - ) or error "cannot move start-stop-daemon: $!"; + return unless length $ssdloc; + if (-e "$ssdloc.REAL") { + move("$ssdloc.REAL", "$ssdloc") + or error "cannot move start-stop-daemon: $!"; + warning "/sbin/start-stop-daemon fake replaced with real"; } }; - if (-f "$options->{root}/sbin/start-stop-daemon") { - if (-e "$options->{root}/sbin/start-stop-daemon.REAL") { - error - "$options->{root}/sbin/start-stop-daemon.REAL already" - . " exists"; + if (length $ssdloc) { + if (-e "$ssdloc.REAL") { + error "$ssdloc.REAL already exists"; } - move( - "$options->{root}/sbin/start-stop-daemon", - "$options->{root}/sbin/start-stop-daemon.REAL" - ) or error "cannot move start-stop-daemon: $!"; - open my $fh, '>', "$options->{root}/sbin/start-stop-daemon" + move("$ssdloc", "$ssdloc.REAL") + or error "cannot move start-stop-daemon: $!"; + open my $fh, '>', $ssdloc or error "cannot open start-stop-daemon: $!"; print $fh "#!/bin/sh\n"; print $fh "echo \"Warning: Fake start-stop-daemon called, doing" . " nothing\">&2\n"; close $fh; - chmod 0755, "$options->{root}/sbin/start-stop-daemon" + chmod 0755, "$ssdloc" or error "cannot chmod start-stop-daemon: $!"; } } @@ -7338,7 +7340,7 @@ them afterwards. This can be disabled using B<--skip=chroot/mount> or specifically by B<--skip=chroot/mount/dev>, B<--skip=chroot/mount/proc> and B<--skip=chroot/mount/sys>, respectively. B will disable running services by temporarily moving F and -F if they exist. This can be disabled with +F if they exist. This can be disabled with B<--skip=chroot/policy-rc.d> and B<--skip=chroot/start-stop-daemon>, respectively. @@ -7385,7 +7387,7 @@ This step is not carried out in B mode. =item B Unmount everything that was mounted during the B stage and restores -F and F if necessary. +F and F if necessary. =item B