From 0464341cd8fc4ae34b608fb018b8baaeba9e841a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 9 May 2016 23:05:00 -0400 Subject: librechroot: give a good error message if binfmt_misc isn't configured --- src/chroot-tools/librechroot | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.2