From 3d3d3fe12d00953ee04663d52afa5a693d9f9558 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 15 Sep 2019 14:12:49 +0200 Subject: [PATCH] Do not copy /etc/resolv.conf or /etc/hostname if the host system doesn't have them --- mmdebstrap | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 2d9a7dd..fa952f2 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1103,8 +1103,16 @@ sub setup { } # allow network access from within - copy("/etc/resolv.conf", "$options->{root}/etc/resolv.conf") or error "cannot copy /etc/resolv.conf: $!"; - copy("/etc/hostname", "$options->{root}/etc/hostname") or error "cannot copy /etc/hostname: $!"; + if (-e "/etc/resolv.conf") { + copy("/etc/resolv.conf", "$options->{root}/etc/resolv.conf") or error "cannot copy /etc/resolv.conf: $!"; + } else { + warning("Host system does not have a /etc/resolv.conf to copy into the rootfs.") + } + if (-e "/etc/hostname") { + copy("/etc/hostname", "$options->{root}/etc/hostname") or error "cannot copy /etc/hostname: $!"; + } else { + warning("Host system does not have a /etc/hostname to copy into the rootfs.") + } if ($options->{havemknod}) { foreach my $file (@devfiles) {