File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 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
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