summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-09 23:05:00 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-09 23:05:00 -0400
commit0464341cd8fc4ae34b608fb018b8baaeba9e841a (patch)
tree709ecd73415e56cbaf3f0146e49a571bb384ddb9
parent9f16ca1852e0461f493ccfbd33792623774d6e1e (diff)
librechroot: give a good error message if binfmt_misc isn't configured
-rwxr-xr-xsrc/chroot-tools/librechroot11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index cc416d5..e671814 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -71,7 +71,16 @@ hack_arch_nspawn_flags() {
fi
if [[ "$CARCH" == armv7h ]] && ! setarch armv7l 2>/dev/null; then
- arch_nspawn_flags+=(-f /usr/bin/qemu-arm-static -s)
+ if grep -xF 'enabled' /proc/sys/fs/binfmt_misc/arm &>/dev/null \
+ && grep -xF 'interpreter /usr/bin/qemu-arm-static' /proc/sys/fs/binfmt_misc/arm &>/dev/null; then
+ arch_nspawn_flags+=(-f /usr/bin/qemu-arm-static -s)
+ else
+ error 'Cannot cross-compile for ARM on x86'
+ plain 'This requires a binfmt_misc entry for qemu-arm-static,'
+ plain 'which is provided by the %s package.' binfmt-qemu-static
+ plain 'If you have this, you may need to restart %s.' systemd-binfmt.service
+ return 1
+ fi
fi
}