forked from gardenlinux/gardenlinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_bare_flavors
executable file
·58 lines (45 loc) · 977 Bytes
/
build_bare_flavors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
set -eufo pipefail
arch=
while [ $# -gt 0 ]; do
case "$1" in
-a|--arch)
arch="$2"
shift 2
;;
*)
break
;;
esac
done
if [ -z "$arch" ]; then
case "$(uname -m)" in
x86_64)
arch=amd64
;;
aarch64|arm64)
arch=arm64
;;
*)
exit 1
;;
esac
fi
config="bare_flavors/${1:-libc}"
base_cname="$(cat "$config/base")-$arch"
target_cname="$(cat "$config/target")-$arch"
./build "$base_cname" "$target_cname"
base_oci=".build/$(grep '\.oci$' ".build/$base_cname")"
target_oci=".build/$(grep '\.oci$' ".build/$target_cname")"
args=(--print-tree "--$(cat "$config/mode")")
if [ -f "$config/include" ]; then
args+=(--include "$config/include")
fi
if [ -f "$config/exclude" ]; then
args+=(--exclude "$config/exclude")
fi
if [ -f "$config/dpkg_include" ]; then
args+=(--dpkg-include "$config/dpkg_include")
fi
mkdir -p .build/bare_flavors
./unbase_oci "${args[@]}" "$base_oci" "$target_oci" ".build/$config-$arch.oci"