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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
_default:
just --list
# Check if host directory exists
host-dir-exists host:
#!/usr/bin/env sh
if [ ! -d {{host}} ]; then
echo "{{host}} does not exist"
exit 1
fi
# Remove common files from host
remove-common host: (host-dir-exists host)
#!/usr/bin/env sh
prefix="./common/"
for file in $(find ./common/ -type f); do
path=${file#$"$prefix"}
rm -f "./{{host}}/files/$path"
done
# Merge common files into host directory
merge-with-common host: (host-dir-exists host)
cp --archive --force ./common/. ./{{host}}/files/
# Remove build artifacts
remove-artifacts host: (host-dir-exists host)
rm -f "./{{host}}/{{host}}.img"
rm -f "./{{host}}/{{host}}.packages"
# Check host reachability via ping
host-reachable host: (host-dir-exists host)
#!/usr/bin/env sh
ping -w 1 -c 1 $(cat ./{{host}}/ADDRESS)
if [ $? -ne 0 ]; then
echo "{{host}} is not reachable"
exit 1
fi
# Test the IMGBUILD by building an image
test host: (host-dir-exists host) (merge-with-common host) && (remove-common host) (remove-artifacts host)
#!/usr/bin/env sh
cd ./{{host}}
sudo makeimg --format "raw 4g msdos ext4"
get-anemos host: (host-reachable host)
ssh root@$(cat ./{{host}}/ADDRESS) wget https://git.sr.ht/~bitfehler/anemos-cli/blob/master/anemos
# Download alpine linux keys
alpine-keys:
#!/usr/bin/env sh
mkdir -p common/etc/apk/keys
cd common/etc/apk/keys
# Copy the names unser APKBUILD from here:
# https://git.alpinelinux.org/aports/plain/main/alpine-keys
keys="
alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub
alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub
alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub
alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub
alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub
alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub
alpine-devel@lists.alpinelinux.org-5e69ca50.rsa.pub
alpine-devel@lists.alpinelinux.org-60ac2099.rsa.pub
alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub
alpine-devel@lists.alpinelinux.org-61666e3f.rsa.pub
alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub
alpine-devel@lists.alpinelinux.org-616abc23.rsa.pub
alpine-devel@lists.alpinelinux.org-616ac3bc.rsa.pub
alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub
alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub
alpine-devel@lists.alpinelinux.org-616db30d.rsa.pub
alpine-devel@lists.alpinelinux.org-66ba20fe.rsa.pub
"
for key in $keys; do
curl -O "https://git.alpinelinux.org/aports/plain/main/alpine-keys/${key}"
done