From 3e5c8d43e73f570a7c022e44b37d682b33d36562 Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Mon, 14 Aug 2017 00:29:12 -0700 Subject: [PATCH] Fix handling of i686 on an x64 host --- lib.sh.in | 5 ++++- mkrootfs.sh.in | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib.sh.in b/lib.sh.in index e3bce40..a2e4b3b 100644 --- a/lib.sh.in +++ b/lib.sh.in @@ -4,6 +4,7 @@ # to function. The only exception is the QEMU binary since it is not # known in advance which one wil be required. readonly LIBTOOLS="cp echo cat printf which mountpoint mount umount modprobe" +readonly HOSTARCH=$(xbps-uhelper arch) info_msg() { # This function handles the printing that is bold within all @@ -74,7 +75,9 @@ umount_pseudofs() { run_cmd_target() { info_msg "Running $* for target $XBPS_TARGET_ARCH ..." - if [ "$XBPS_TARGET_ARCH" = "$(xbps-uhelper arch)" ] ; then + if [ "$XBPS_TARGET_ARCH" = "${HOSTARCH}" ] || + [ -z "${XBPS_TARGET_ARCH##*86*}" ] && + [ -z "${HOSTARCH##*86*}" ] ; then # This is being run on the same architecture as the host, # therefore we should set XBPS_ARCH. if ! eval XBPS_ARCH="$XBPS_TARGET_ARCH" "$@" ; then diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in index bb83568..c900d46 100644 --- a/mkrootfs.sh.in +++ b/mkrootfs.sh.in @@ -156,8 +156,13 @@ info_msg "Reconfiguring packages for ${XBPS_TARGET_ARCH} ..." # This step sets up enough of the base-files that the chroot will work # and they can be reconfigured natively. Without this step there # isn't enough configured for ld to work. This step runs as the host -# architecture. -run_cmd "xbps-reconfigure -r $ROOTFS base-files" +# architecture, but on x86 some special extra steps have to be taken +# to make this work. +if [ -z "${XBPS_TARGET_ARCH##*86*}" ] && [ -z "${HOSTARCH##*86*}" ] ; then + run_cmd_target "xbps-reconfigure --rootdir $ROOTFS base-files" +else + run_cmd "xbps-reconfigure --rootdir $ROOTFS base-files" +fi # Now running as the target system, this step reconfigures the # base-files completely. Certain things just won't work in the first