for simplicity, always use our own /dev tar entries

This commit is contained in:
Johannes 'josch' Schauer 2018-10-23 15:19:01 +02:00
parent 7534a7607f
commit 174d54f933
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1634,9 +1634,8 @@ sub main() {
} }
my $devtar = ''; my $devtar = '';
# without real device nodes having been created, we manually craft the # We always craft the /dev entries ourselves if a tarball is to be created
# right entries for the final tarball if ($options->{maketar}) {
if ($options->{maketar} and not $options->{havemknod}) {
foreach my $file (@devfiles) { foreach my $file (@devfiles) {
my ($fname, $mode, $type, $linkname, $devmajor, $devminor) = @{$file}; my ($fname, $mode, $type, $linkname, $devmajor, $devminor) = @{$file};
my $entry = pack('a100 a8 a8 a8 a12 a12 A8 a1 a100 a8 a32 a32 a8 a8 a155 x12', my $entry = pack('a100 a8 a8 a8 a12 a12 A8 a1 a100 a8 a32 a32 a8 a8 a155 x12',
@ -1663,7 +1662,7 @@ sub main() {
} }
my $exitstatus = 0; my $exitstatus = 0;
my @taropts = ('--sort=name', "--mtime=\@$mtime", '--clamp-mtime', '--numeric-owner', '--one-file-system', '-c'); my @taropts = ('--sort=name', "--mtime=\@$mtime", '--clamp-mtime', '--numeric-owner', '--one-file-system', '-c', '--exclude=./dev');
push @taropts, @tar_compress_opts; push @taropts, @tar_compress_opts;
my $pid; my $pid;
pipe my $rfh, my $wfh; pipe my $rfh, my $wfh;
@ -1687,7 +1686,7 @@ sub main() {
print $devtar; print $devtar;
# pack everything except ./dev # pack everything except ./dev
0 == system('tar', @taropts, '--exclude=./dev', '-C', $options->{root}, '.') or die "tar failed: $?"; 0 == system('tar', @taropts, '-C', $options->{root}, '.') or die "tar failed: $?";
print STDERR "done\n"; print STDERR "done\n";
} }
@ -1722,7 +1721,7 @@ sub main() {
} elsif ($options->{mode} eq 'proot') { } elsif ($options->{mode} eq 'proot') {
# proot requires tar to run inside proot or otherwise # proot requires tar to run inside proot or otherwise
# permissions will be completely off # permissions will be completely off
0 == system('proot', '--root-id', "--rootfs=$options->{root}", '--cwd=/', 'tar', @taropts, '--exclude=./dev', '-C', '/', '.') or die "tar failed: $?"; 0 == system('proot', '--root-id', "--rootfs=$options->{root}", '--cwd=/', 'tar', @taropts, '-C', '/', '.') or die "tar failed: $?";
} elsif (any { $_ eq $options->{mode} } ('root', 'chrootless')) { } elsif (any { $_ eq $options->{mode} } ('root', 'chrootless')) {
0 == system('tar', @taropts, '-C', $options->{root}, '.') or die "tar failed: $?"; 0 == system('tar', @taropts, '-C', $options->{root}, '.') or die "tar failed: $?";
} else { } else {