From 790294ddcac671651c9e5cb5eb0d135f1383a53a Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 26 May 2022 07:27:24 +0200 Subject: [PATCH] hooks/merged-usr: acquire native architecture from apt-config `dpkg --print-architecture` will be wrong when creating a foreign architecture chroot and we cannot chroot() as the chroot directory is still empty. --- hooks/merged-usr/setup00.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hooks/merged-usr/setup00.sh b/hooks/merged-usr/setup00.sh index 13f9ab4..3a2af74 100755 --- a/hooks/merged-usr/setup00.sh +++ b/hooks/merged-usr/setup00.sh @@ -47,11 +47,8 @@ fi TARGET="$1" -if [ -e "$TARGET/var/lib/dpkg/arch" ]; then - ARCH=$(head -1 "$TARGET/var/lib/dpkg/arch") -else - ARCH=$(dpkg --print-architecture) -fi +ARCH=$(dpkg --print-architecture) +eval "$(APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-config shell ARCH Apt::Architecture)" if [ -e /usr/share/debootstrap/functions ]; then . /usr/share/debootstrap/functions