Преглед на файлове

Fix handling of i686 on an x64 host

Michael Aldridge преди 7 години
родител
ревизия
3e5c8d43e7
променени са 2 файла, в които са добавени 11 реда и са изтрити 3 реда
  1. 4 1
      lib.sh.in
  2. 7 2
      mkrootfs.sh.in

+ 4 - 1
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

+ 7 - 2
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