dpkg 1.22.3 moved start-stop-daemon from /sbin to /usr/sbin, see #1059982

This commit is contained in:
Johannes Schauer Marin Rodrigues 2024-01-25 09:30:26 +01:00
parent ae5bddb2aa
commit 4d72f617d9
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1551,32 +1551,34 @@ sub setup_mounts {
if (any { $_ eq 'chroot/start-stop-daemon' } @{ $options->{skip} }) { if (any { $_ eq 'chroot/start-stop-daemon' } @{ $options->{skip} }) {
info "skipping chroot/start-stop-daemon as requested"; info "skipping chroot/start-stop-daemon as requested";
} else { } 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 { push @cleanup_tasks, sub {
if (-e "$options->{root}/sbin/start-stop-daemon.REAL") { return unless length $ssdloc;
move( if (-e "$ssdloc.REAL") {
"$options->{root}/sbin/start-stop-daemon.REAL", move("$ssdloc.REAL", "$ssdloc")
"$options->{root}/sbin/start-stop-daemon" or error "cannot move start-stop-daemon: $!";
) 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 (length $ssdloc) {
if (-e "$options->{root}/sbin/start-stop-daemon.REAL") { if (-e "$ssdloc.REAL") {
error error "$ssdloc.REAL already exists";
"$options->{root}/sbin/start-stop-daemon.REAL already"
. " exists";
} }
move( move("$ssdloc", "$ssdloc.REAL")
"$options->{root}/sbin/start-stop-daemon", or error "cannot move start-stop-daemon: $!";
"$options->{root}/sbin/start-stop-daemon.REAL" open my $fh, '>', $ssdloc
) or error "cannot move start-stop-daemon: $!";
open my $fh, '>', "$options->{root}/sbin/start-stop-daemon"
or error "cannot open start-stop-daemon: $!"; or error "cannot open start-stop-daemon: $!";
print $fh "#!/bin/sh\n"; print $fh "#!/bin/sh\n";
print $fh print $fh
"echo \"Warning: Fake start-stop-daemon called, doing" "echo \"Warning: Fake start-stop-daemon called, doing"
. " nothing\">&2\n"; . " nothing\">&2\n";
close $fh; close $fh;
chmod 0755, "$options->{root}/sbin/start-stop-daemon" chmod 0755, "$ssdloc"
or error "cannot chmod start-stop-daemon: $!"; 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 specifically by B<--skip=chroot/mount/dev>, B<--skip=chroot/mount/proc> and
B<--skip=chroot/mount/sys>, respectively. B<mmdebstrap> will disable running B<--skip=chroot/mount/sys>, respectively. B<mmdebstrap> will disable running
services by temporarily moving F</usr/sbin/policy-rc.d> and services by temporarily moving F</usr/sbin/policy-rc.d> and
F</sbin/start-stop-daemon> if they exist. This can be disabled with F</usr/sbin/start-stop-daemon> if they exist. This can be disabled with
B<--skip=chroot/policy-rc.d> and B<--skip=chroot/start-stop-daemon>, B<--skip=chroot/policy-rc.d> and B<--skip=chroot/start-stop-daemon>,
respectively. respectively.
@ -7385,7 +7387,7 @@ This step is not carried out in B<extract> mode.
=item B<unmount> =item B<unmount>
Unmount everything that was mounted during the B<mount> stage and restores Unmount everything that was mounted during the B<mount> stage and restores
F</usr/sbin/policy-rc.d> and F</sbin/start-stop-daemon> if necessary. F</usr/sbin/policy-rc.d> and F</usr/sbin/start-stop-daemon> if necessary.
=item B<cleanup> =item B<cleanup>