summaryrefslogtreecommitdiffstats
path: root/debian/armv6k-support.preinst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/armv6k-support.preinst50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/armv6k-support.preinst b/debian/armv6k-support.preinst
new file mode 100644
index 0000000..2952be1
--- /dev/null
+++ b/debian/armv6k-support.preinst
@@ -0,0 +1,50 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+ FILE="/usr/libexec/x86_64-linux-gnu/isa-support/test-ARMv6K"
+ # "exec >;command" instead of "command >" looks strange but regular
+ # redirections don't fully work within qemu-user.
+ ret=0;(exec >/dev/null 2>&1; "$FILE") || ret=$?
+ if [ $ret -ne 0 ] && [ -n "$IGNORE_ISA" ]; then
+ cat >&2 <<END
+This machine doesn't support ARMv6K, but override (IGNORE_ISA) is enabled.
+Continuing...
+END
+ ret=0
+ fi
+
+ if [ $ret -eq 126 ]; then
+ cat >&2 <<END
+Couldn't execute test binary for ARMv6K, you either do foreign multi-arch
+without qemu or do something strange. Assuming you know what you're doing.
+Continuing...
+END
+ ret=0
+ fi
+
+ if [ $ret -ne 0 ]; then
+ # Fail noisily, first via debconf (if installed).
+ if [ -e /usr/share/debconf/confmodule ]; then
+
+ . /usr/share/debconf/confmodule
+ db_version 2.0
+
+ db_fset ARMv6K-support/fail seen false ||:
+ db_reset ARMv6K-support/fail ||:
+ db_input critical ARMv6K-support/fail ||:
+ db_go ||:
+ db_stop ||:
+ fi
+
+ cat >&2 <<END
+This machine doesn't support ARMv6K, sorry.
+Aborting.
+END
+ exit 2
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0