summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-10-30 12:43:34 +0100
committerJonas Smedegaard <dr@jones.dk>2016-11-01 11:19:07 +0100
commit47c8f454347af07881281b088c1e99f8be8aa1b8 (patch)
treef47f9a98b1f9daa261cfbea4f0e5ccb07f7b6709
parent3eb3b581fa5de79300e67d3619fa8cf745c61596 (diff)
Improve QEMU handling: Skip if missing (e.g. when targeting i386 on amd64 host).
-rwxr-xr-xskel/multistrap-hooks/completion_50_configscript.sh13
1 files changed, 6 insertions, 7 deletions
diff --git a/skel/multistrap-hooks/completion_50_configscript.sh b/skel/multistrap-hooks/completion_50_configscript.sh
index 44ca37a..17b3a77 100755
--- a/skel/multistrap-hooks/completion_50_configscript.sh
+++ b/skel/multistrap-hooks/completion_50_configscript.sh
@@ -28,8 +28,7 @@ arch_host=$(dpkg --print-architecture)
# libssl needs either HOME or RANDFILE defined
export RANDFILE=/root/.rnd.installer
-# TODO: check for incompatible (not just different) arch
-if [ -n "$FAKEROOTKEY" ] && [ "$FAKECHROOT" != "true" ] && [ "$arch" != "$arch_host" ]; then
+if [ "$arch" != "$arch_host" ]; then
# Favor dpkg-dev tools (most reliable but pulls many packages)
if which dpkg-architecture; then
multiarch=$(dpkg-architecture -a"$arch" -qDEB_TARGET_MULTIARCH)
@@ -38,13 +37,13 @@ if [ -n "$FAKEROOTKEY" ] && [ "$FAKECHROOT" != "true" ] && [ "$arch" != "$arch_h
multiarch=$(basename "$(dirname "$(find "$fs/usr/lib" -type d -name libfakeroot)")")
cpu=$(echo "multiarch" | cut -d- -f1)
fi
+ qemu=$(/usr/sbin/update-binfmts --display "qemu-$cpu" | grep -Po '(?<=interpreter = /usr/bin/).*') #'
+fi
+if [ -n "$FAKEROOTKEY" ] && [ "$FAKECHROOT" != "true" ]; then
PATH=/usr/sbin:/usr/bin:/sbin:/bin \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/$multiarch/libfakeroot" \
- QEMU_LD_PREFIX="$fs" \
- proot -r "$fs" -b /proc -b /sys -b /dev -q "qemu-$cpu" -w / /multistrap-configure.sh
-elif [ -n "$FAKEROOTKEY" ] && [ "$FAKECHROOT" != "true" ]; then
- PATH=/usr/sbin:/usr/bin:/sbin:/bin \
- proot -r "$fs" -b /proc -b /sys -b /dev -w / /multistrap-configure.sh
+ ${qemu:+QEMU_LD_PREFIX="$fs"} \
+ proot -r "$fs" -b /proc -b /sys -b /dev ${qemu:+-q "$qemu"} -w / /multistrap-configure.sh
else
sudo=sudo
if [ "$(whoami)" = "root" ]; then