forked from josch/mmdebstrap
die if copy() fails
This commit is contained in:
parent
640d854c2e
commit
a9db385868
1 changed files with 5 additions and 7 deletions
12
mmdebstrap
12
mmdebstrap
|
@ -935,7 +935,7 @@ sub setup {
|
||||||
if (!-e $qemubin) {
|
if (!-e $qemubin) {
|
||||||
die "cannot find $qemubin";
|
die "cannot find $qemubin";
|
||||||
}
|
}
|
||||||
copy $qemubin, "$options->{root}/$qemubin";
|
copy $qemubin, "$options->{root}/$qemubin" or die "cannot copy $qemubin: $!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,8 +1106,8 @@ sub setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
# allow network access from within
|
# allow network access from within
|
||||||
copy("/etc/resolv.conf", "$options->{root}/etc/resolv.conf");
|
copy("/etc/resolv.conf", "$options->{root}/etc/resolv.conf") or die "cannot copy /etc/resolv.conf: $!";
|
||||||
copy("/etc/hostname", "$options->{root}/etc/hostname");
|
copy("/etc/hostname", "$options->{root}/etc/hostname") or die "cannot copy /etc/hostname: $!";
|
||||||
|
|
||||||
print STDERR "I: installing remaining packages inside the chroot...\n";
|
print STDERR "I: installing remaining packages inside the chroot...\n";
|
||||||
run_apt_progress @chrootcmd, 'apt-get', '--yes', 'install', keys %pkgs_to_install;
|
run_apt_progress @chrootcmd, 'apt-get', '--yes', 'install', keys %pkgs_to_install;
|
||||||
|
@ -1584,11 +1584,9 @@ sub main() {
|
||||||
close $wfh;
|
close $wfh;
|
||||||
if ($options->{maketar}) {
|
if ($options->{maketar}) {
|
||||||
if ($options->{target} ne '-') {
|
if ($options->{target} ne '-') {
|
||||||
open(my $fh, '>', $options->{target});
|
copy($rfh, $options->{target}) or die "cannot copy to $options->{target}: $!";
|
||||||
copy($rfh, $fh);
|
|
||||||
close($fh);
|
|
||||||
} else {
|
} else {
|
||||||
copy($rfh, *STDOUT);
|
copy($rfh, *STDOUT) or die "cannot copy to standard output: $!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close($rfh);
|
close($rfh);
|
||||||
|
|
Loading…
Reference in a new issue