From 3999212c48c47d453398fe982d6a23c1fa73d340 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 22 Sep 2022 14:22:37 +0200 Subject: [PATCH] always create /var/lib/dpkg/arch to make foreign architecture chrootless tarballs bit-by-bit identical --- mmdebstrap | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 243b460..3fb7662 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1858,18 +1858,14 @@ sub run_setup() { close $fh; } - # we create /var/lib/dpkg/arch inside the chroot either if there is more - # than the native architecture in the chroot or if chrootless mode is - # used to create a chroot of a different architecture than the native - # architecture outside the chroot. + # In theory, /var/lib/dpkg/arch is only useful if there are foreign + # architectures configured or if the architecture of a chrootless chroot + # is different from the native architecture outside the chroot. + # We nevertheless always add /var/lib/dpkg/arch to make a chroot built the + # normal way bit-by-bit identical to a foreign arch chroot built in + # chrootless mode. chomp(my $hostarch = `dpkg --print-architecture`); - if ( - (!-e "$options->{root}/var/lib/dpkg/arch") - and ( - scalar @{ $options->{foreignarchs} } > 0 - or ( $options->{mode} eq 'chrootless' - and $hostarch ne $options->{nativearch})) - ) { + if ((!-e "$options->{root}/var/lib/dpkg/arch")) { open my $fh, '>', "$options->{root}/var/lib/dpkg/arch" or error "cannot open /var/lib/dpkg/arch: $!"; print $fh "$options->{nativearch}\n";