discover/boot: abort kexec on any error from validation
[petitboot] / docker / builder-include
1 #!/usr/bin/env bash
2
3 arch() {
4         local m="$(uname -m)"
5
6         case "${m}" in
7                 aarch64) echo "arm64" ;;
8                 x86_64)  echo "amd64" ;;
9                 *)       echo "${m}" ;;
10         esac
11 }
12
13 arch_tag() {
14         local a="$(arch)"
15
16         case "${a}" in
17                 amd64) echo "" ;;
18                 *)     echo "-${a}" ;;
19         esac
20 }
21
22 run_cmd () {
23         local cmd="${*}"
24
25         if [[ -n ${verbose} || -n "${dry_run}" ]]; then
26                 echo "==> ${cmd}"
27         fi
28
29         if [[ -n "${dry_run}" ]]; then
30                 true
31         else
32                 eval "${cmd}"
33         fi
34 }
35
36 show_tag () {
37         echo "${DOCKER_TAG}"
38 }
39
40 : ${VERSION:="1"}
41 : ${ARCH_TAG:="$(arch_tag)"}
42 : ${DOCKER_NAME:="pb-builder"}
43 : ${DOCKER_TAG:="${DOCKER_NAME}:${VERSION}${ARCH_TAG}"}