Skip to content

Commit 61af32f

Browse files
committed
Update debian/control suggests to support building arm on amd64 and add contrib script to install deps
1 parent a691707 commit 61af32f

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

contrib/install-arm-on-amd-deps

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -eu
2+
3+
QUIET=
4+
pkgs=(binfmt-support qemu-system-arm qemu-user-static)
5+
bins=(/usr/sbin/update-binfmts /usr/bin/qemu-system-arm /usr/bin/qemu-arm-static)
6+
pkgs_to_install=()
7+
8+
usage() {
9+
cat <<EOF
10+
$(basename "$0") [-h|--help] [-q|--quiet]
11+
12+
Checks packages required to build arm64 on amd64 are installed
13+
and if not, installs them.
14+
15+
args::
16+
17+
-h|--help show this help and exit
18+
-q|--quiet no output
19+
EOF
20+
}
21+
22+
while [[ $# -ne 0 ]]; do
23+
case $1 in
24+
-h|--help)
25+
usage;;
26+
-q|--quiet)
27+
QUIET=y;;
28+
*)
29+
echo "Unknown option: $1" >&2
30+
exit 1;;
31+
esac
32+
shift
33+
done
34+
35+
install_pkgs() {
36+
COM1=$(apt-get update 2>&1)
37+
COM2=$(apt-get install -y "$@" 2>&1)
38+
if [[ -z "$QUIET" ]]; then
39+
$COM1 >/dev/null
40+
$COM2 >/dev/null
41+
else
42+
$COM1
43+
$COM2
44+
fi
45+
}
46+
47+
for i in "${!pkgs[@]}"; do
48+
if ! which "${bins[$i]}"; then
49+
pkgs_to_install+=("${pkgs[$i]}")
50+
fi
51+
done
52+
# shellcheck disable=SC2128
53+
# even if there are no elements in a array; ${foo[@]} still isn't "empty"
54+
if [[ -n "$pkgs_to_install" ]]; then
55+
install "$pkgs_to_install"
56+
fi

debian/control

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ Recommends:
2525
Suggests:
2626
dd,
2727
wodim,
28+
binfmt-support,
29+
qemu-system-arm,
30+
qemu-user-static
2831
Description: TurnKey GNU/Linux product fabrication framework

debian/install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
share/* usr/share/fab
2+
contrib/install-arm-on-amd-deps usr/bin

0 commit comments

Comments
 (0)