unless in chrootless mode, omitting stuff in /var/lib/dpkg does not depend on the dpkg version outside, but on the version inside the chroot (and we don't know that one yet)

This commit is contained in:
Johannes 'josch' Schauer 2020-08-24 16:28:32 +02:00
parent dd64e8220d
commit 8f09c3e02f
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1310,7 +1310,11 @@ sub run_setup() {
); );
# we need /var/lib/dpkg in case we need to write to /var/lib/dpkg/arch # we need /var/lib/dpkg in case we need to write to /var/lib/dpkg/arch
push @directories, '/var/lib/dpkg'; push @directories, '/var/lib/dpkg';
if (not defined $dpkgversion or $dpkgversion < "1.20.0") { # since we do not know the dpkg version inside the chroot at this
# point, we can only omit it in chrootless mode
if ( $options->{mode} ne 'chrootless'
or not defined $dpkgversion
or $dpkgversion < "1.20.0") {
push @directories, '/etc/dpkg/dpkg.cfg.d/'; push @directories, '/etc/dpkg/dpkg.cfg.d/';
} }
# if dpkg and apt operate from the outside we need some more # if dpkg and apt operate from the outside we need some more
@ -1318,7 +1322,11 @@ sub run_setup() {
# the chroot # the chroot
if ($options->{mode} eq 'chrootless') { if ($options->{mode} eq 'chrootless') {
push @directories, '/var/log/apt'; push @directories, '/var/log/apt';
if (not defined $dpkgversion or $dpkgversion < "1.20.0") { # since we do not know the dpkg version inside the chroot at this
# point, we can only omit it in chrootless mode
if ( $options->{mode} ne 'chrootless'
or not defined $dpkgversion
or $dpkgversion < "1.20.0") {
push @directories, '/var/lib/dpkg/triggers', push @directories, '/var/lib/dpkg/triggers',
'/var/lib/dpkg/info', '/var/lib/dpkg/alternatives', '/var/lib/dpkg/info', '/var/lib/dpkg/alternatives',
'/var/lib/dpkg/updates'; '/var/lib/dpkg/updates';
@ -1424,7 +1432,11 @@ sub run_setup() {
# /var/lib/dpkg/available is required to exist or otherwise package # /var/lib/dpkg/available is required to exist or otherwise package
# removals will fail # removals will fail
if (not defined $dpkgversion or $dpkgversion < "1.20.0") { # since we do not know the dpkg version inside the chroot at this point, we
# can only omit it in chrootless mode
if ( $options->{mode} ne 'chrootless'
or not defined $dpkgversion
or $dpkgversion < "1.20.0") {
open my $fh, '>', "$options->{root}/var/lib/dpkg/available" open my $fh, '>', "$options->{root}/var/lib/dpkg/available"
or error "failed to open(): $!"; or error "failed to open(): $!";
close $fh; close $fh;
@ -1432,7 +1444,11 @@ sub run_setup() {
# /var/lib/dpkg/cmethopt is used by dselect # /var/lib/dpkg/cmethopt is used by dselect
# see #930788 # see #930788
if (not defined $dpkgversion or $dpkgversion < "1.20.0") { # since we do not know the dpkg version inside the chroot at this point, we
# can only omit it in chrootless mode
if ( $options->{mode} ne 'chrootless'
or not defined $dpkgversion
or $dpkgversion < "1.20.0") {
open my $fh, '>', "$options->{root}/var/lib/dpkg/cmethopt" open my $fh, '>', "$options->{root}/var/lib/dpkg/cmethopt"
or error "failed to open(): $!"; or error "failed to open(): $!";
print $fh "apt apt\n"; print $fh "apt apt\n";