summaryrefslogtreecommitdiff
path: root/generate.sh
blob: bc9d72ec8eac805160deb902dbd41dc63c9bbb90 (plain)
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
#!/bin/bash
set -eu
cd "$(dirname "$(readlink -f "$0")")"

# Turris #########################################################################
declare -A boards animals
boards=(["mox"]="aarch64_cortex-a53" ["omnia"]="arm_cortex-a9_vfpv3-d16" ["turris1x"]="powerpc_8540")
animals=(["snails"]="hbs" ["turtles"]="hbt" ["kittens"]="hbk" ["lions"]="hbl" ["dragons"]="hbd")

for animal in "${!animals[@]}"; do
	for board in "${!boards[@]}"; do
		job="turris-$animal-$board"
		echo "Generating: $job"
		ln -sf ../templates/turris.run "jobs/$job.run"
		ln -sf ../templates/turris.conf "jobs/$job.conf"
		cat >"jobs/$job.env" <<-EOF
			BOARD=$board
			ANIMAL=${animals[$animal]}
			ARCH=${boards[$board]}
		EOF
	done
done


# Alpine #########################################################################
declare -A archmap qemu
archs=("aarch64" "amd64" "armhf" "armv7")
archmap=(["amd64"]="x86_64")
qemu=(["armhf"]="arm" ["armv7"]="arm")

for arch in "${archs[@]}"; do
	job="alpine-$arch"
	echo "Generating: $job"
	ln -sf ../templates/alpine.run "jobs/$job.run"
	ln -sf ../templates/alpine.conf "jobs/$job.conf"
	if [ -n "${archmap[$arch]+x}" ]; then
		arch="${archmap[$arch]}"
	fi
	{
		echo "ARCH=$arch"
		[ -z "${qemu[$arch]+x}" ] || \
			echo "QEMU_ARCH=${qemu[$arch]}"
	} >"jobs/$job.env"
done