check whether /sbin/start-stop-daemon.REAL exists before overwriting it
This commit is contained in:
parent
daab09bfdd
commit
da4f9e4349
1 changed files with 4 additions and 0 deletions
|
@ -862,7 +862,11 @@ sub run_chroot(&$) {
|
||||||
chmod 0755, "$options->{root}/usr/sbin/policy-rc.d" or error "cannot chmod policy-rc.d: $!";
|
chmod 0755, "$options->{root}/usr/sbin/policy-rc.d" or error "cannot chmod policy-rc.d: $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# the file might not exist if it was removed in a hook
|
||||||
if (-e "$options->{root}/sbin/start-stop-daemon") {
|
if (-e "$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";
|
||||||
|
}
|
||||||
move("$options->{root}/sbin/start-stop-daemon", "$options->{root}/sbin/start-stop-daemon.REAL") or error "cannot move start-stop-daemon: $!";
|
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" or error "cannot open start-stop-daemon: $!";
|
open my $fh, '>', "$options->{root}/sbin/start-stop-daemon" or error "cannot open start-stop-daemon: $!";
|
||||||
print $fh "#!/bin/sh\n";
|
print $fh "#!/bin/sh\n";
|
||||||
|
|
Loading…
Reference in a new issue