File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed
Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash -eu
2+
3+ DEBUG=${DEBUG:- }
4+ [[ -z " $DEBUG " ]] || set -x
5+
6+ QUIET=
7+ pkgs=(binfmt-support qemu-system-arm qemu-user-static)
8+ bins=(/usr/sbin/update-binfmts /usr/bin/qemu-system-arm /usr/bin/qemu-arm-static)
9+ pkgs_to_install=()
10+
11+ usage () {
12+ cat << EOF
13+ $( basename " $0 " ) [-h|--help] [-q|--quiet]
14+
15+ Checks packages required to build arm64 on amd64 are installed
16+ and if not, installs them.
17+
18+ args::
19+
20+ -h|--help show this help and exit
21+ -q|--quiet no output
22+
23+ env vars::
24+
25+ DEBUG verbose output - overrides -q|--quiet
26+
27+ EOF
28+ }
29+
30+ while [[ $# -ne 0 ]]; do
31+ case $1 in
32+ -h|--help)
33+ usage;;
34+ -q|--quiet)
35+ QUIET=q;;
36+ * )
37+ echo " Unknown option: $1 " >&2
38+ exit 1;;
39+ esac
40+ shift
41+ done
42+
43+ for i in " ${! pkgs[@]} " ; do
44+ if ! which " ${bins[$i]} " ; then
45+ pkgs_to_install+=(" ${pkgs[$i]} " )
46+ fi
47+ done
48+
49+ set +u # unset u - otherwise the test will give an "unbound variable" error
50+ # shellcheck disable=SC2128
51+ # even if there are no elements in a array; ${foo[@]} still isn't "empty"
52+ if [[ -n " $pkgs_to_install " ]]; then
53+ if [[ -n " $QUIET " ]]; then
54+ echo " Installing: ${pkgs_to_install[*]} "
55+ apt-get update
56+ apt-get install -y " ${pkgs_to_install[@]} "
57+ echo " "
58+ else
59+ apt-get update > /dev/null 2>&1
60+ apt-get install -y " ${pkgs_to_install[@]} " > /dev/null 2>&1
61+ fi
62+ fi
63+
64+ update-binfmts --display | grep -i" $QUIET " aarch
Original file line number Diff line number Diff line change @@ -25,4 +25,7 @@ Recommends:
2525Suggests:
2626 dd,
2727 wodim,
28+ binfmt-support,
29+ qemu-system-arm,
30+ qemu-user-static
2831Description: TurnKey GNU/Linux product fabrication framework
Original file line number Diff line number Diff line change 11share/* usr/share/fab
2+ contrib/install-arm-on-amd-deps usr/bin
You can’t perform that action at this time.
0 commit comments