only write /usr/sbin/policy-rc.d if /usr/sbin exists in the chroot

This commit is contained in:
Johannes 'josch' Schauer 2019-10-28 14:51:49 +01:00
parent c5a96736ef
commit daab09bfdd
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -853,7 +853,8 @@ sub run_chroot(&$) {
}
# prevent daemons from starting
{
# the directory might not exist in custom variant, for example
if (-d "$options->{root}/usr/sbin/") {
open my $fh, '>', "$options->{root}/usr/sbin/policy-rc.d" or error "cannot open policy-rc.d: $!";
print $fh "#!/bin/sh\n";
print $fh "exit 101\n";