-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
209 lines (161 loc) · 7.07 KB
/
Copy pathMakefile
File metadata and controls
209 lines (161 loc) · 7.07 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
.ONESHELL:
SHELL = /bin/bash
deploy-manifests-prod:
hack/deploy_manifests.sh deploy/butane/base/coreos/files/k3s/manifests
kustomize_base_dir := "pkg"
manifests_prod_dir := "deploy/butane/overlays/prod/usr/local/lib/rancher/k3s/server/manifests"
manifests_base_dir := "deploy/butane/base/usr/local/lib/rancher/k3s/server/manifests"
manifests_staging_dir := "deploy/butane/base/usr/local/lib/rancher/k3s/server/manifests"
clean:
rm -rf ${manifests_prod_dir}/*
rm -rf ${manifests_base_dir}/*
rm -rf ${manifests_staging_dir}/*
find . -type d -iname "gen_ignition.sh.*" -exec rm -rf {} \;
kube-manifests-gen-base:
hack/gen_kube_manifests.sh ${kustomize_base_dir} ${manifests_base_dir} base
kube-manifests-gen-prod:
hack/gen_kube_manifests.sh ${kustomize_base_dir} ${manifests_prod_dir} prod
kube-manifests-gen-staging:
hack/gen_kube_manifests.sh ${kustomize_base_dir} ${manifests_staging_dir} staging
kube-manifests-gen-rpi4-0:
hack/gen_kube_manifests.sh ${kustomize_base_dir} ${manifests_prod_dir} rpi4-0
kube-manifests-gen-all: clean kube-manifests-gen-prod kube-manifests-gen-rpi4-0
ignition_dest := "deploy/.ignition"
ignition-gen-staging: kube-manifests-gen-staging
hack/ignition/gen_ignition.sh deploy/butane/overlays/staging/main.bu ${ignition_dest}/staging_main.ign
ignition-gen-prod: kube-manifests-gen-all
DEBUG=$${DEBUG:-} hack/ignition/gen_ignition.sh deploy/butane/overlays/prod/main.bu
ignition-gen-rpi4:
hack/ignition/gen_ignition.sh deploy/butane/overlays/rpi4/main.bu ${ignition_dest}/rpi4_main.ign
ignition-gen-rpi02w-0:
hack/ignition/gen_ignition.sh deploy/butane/overlays/rpi02w.0/main.bu ${ignition_dest}/rpi02w-0_main.ign
ignition-serve-http-base:
hack/ignition/deploy/serve_ignition.sh base
ignition-serve-http-staging:
hack/ignition/deploy/serve_ignition.sh staging
ignition-serve-http-prod: ignition-gen-prod
hack/ignition/deploy/serve_ignition.sh prod
ignition-serve-http-rpi4:
hack/ignition/deploy/serve_ignition.sh rpi4
ignition-serve-http-rpi02w-0: ignition-gen-rpi02w-0
hack/ignition/deploy/serve_ignition.sh rpi02w-0
# TODO add --post-install to setup btrfs subvolumes
installer-download-baremetal:
coreos-installer download \
--stream stable \
--platform metal \
--format iso \
--directory deploy/coreos-installer/iso
installer-butane-check-base:
butane --check \
--strict \
--files-dir deploy/butane/base/coreos-installer \
< deploy/butane/base/coreos-installer/install.bu
installer-butane-check-prod: installer-butane-check-base
butane --check \
--strict \
--files-dir deploy/butane \
< deploy/butane/overlays/prod/coreos-installer/install.bu
installer-ignition-gen-base: installer-butane-check-base
butane --pretty \
--strict \
--files-dir deploy/butane/base/coreos-installer \
< deploy/butane/base/coreos-installer/install.bu \
| gzip -v -9 > deploy/butane/base/coreos-installer/install.ign.gz
. hack/lib/hash.sh
hash_data=deploy/butane/base/coreos-installer/install.ign.gz
sha512sum_gen $${hash_data}
installer-ignition-gen-prod: installer-butane-check-prod installer-ignition-gen-base
. hack/lib/hash.sh
base_ign_checksum_in=deploy/butane/base/coreos-installer/install.ign.gz.sha512
sha512sum_check $${base_ign_checksum_in}
prod_ign_out=deploy/butane/overlays/prod/coreos-installer/install.ign
prod_butane_in=deploy/butane/overlays/prod/coreos-installer/install.bu
butane --pretty \
--strict \
--files-dir deploy/butane \
--output $${prod_ign_out} \
< $${prod_butane_in}
hack/bin/ignition-config-hash-upsert.sh \
$${base_ign_checksum_in} \
$${prod_ign_out}
sha512sum_gen $${prod_ign_out}
installer-ignition-gen-all: installer-ignition-gen-prod
# Example of writing this image to a drive:
# Replace this with the correct drive!
# iso_out="/dev/sdc"
# iso_in="deploy/coreos-installer/iso/fedora-coreos-43.20251214.3.0-live-iso.x86_64.iso"
# sudo dd if="$iso_in" of="$iso_out" status=progress && sudo sync
installer-iso-customize: installer-ignition-gen-prod
iso="$$(find deploy/coreos-installer/iso -type f -iname "*.iso" | sort -V | head -n1)"
coreos-installer iso \
customize \
--pre-install hack/coreos-installer/post-install.sh \
-o $${iso/.iso/_custom.iso} \
./$${iso}
images := "$(HOME)/.local/share/libvirt/images"
installer-download-libvirt:
coreos-installer download \
-s ${stream} \
-p qemu \
-f qcow2.xz \
--decompress
staging_vm_name := "rick-dev"
vm-staging-create: ignition-gen-staging
chcon -t svirt_home_t ${ignition_dest}/staging_main.ign
hack/manage_dev_vm.sh create ${staging_vm_name} ${ignition_dest}/staging_main.ign
vm-staging-delete:
hack/manage_dev_vm.sh delete ${staging_vm_name}
vm_ip_address := "192.168.122.2"
ssh_id := ~/.ssh/id_ed25519
# TODO make this configurable to use with production systems
k3s-token-upload:
hack/upload_k3s_token.sh "rick-dev" \
${ssh_id} \
${vm_ip_address}
### Containerfile Start ###
ctr_repo_remote := "docker.io/steve51516"
ctr_repo_local := "localhost/steve51516"
ctr_context_local_dir := "pkg/containers"
ctr_build_env_dir := "hack/env/podman/build"
ctr_build_constant_env_file := "hack/lib/podman/build/constants.env"
ctr_build_script_file := "hack/bin/podman-build.sh"
DEBUG?=
export DEBUG
# TODO setup these targets once their respective context directory Containerfiles have been corrected with the new podman-build.sh expected format
# container-build-archlinuxarm-base:
# * TODO rework this image build to be much slimmer. It's currently massive.
# container-build-ffmpeg-rpi: container-build-archlinuxarm-base
LIBCAMERA_VERSION_GIT_TAG_OVERRIDE?=
export LIBCAMERA_VERSION_GIT_TAG_OVERRIDE
container-build-libcamera:
. ${ctr_build_constant_env_file}
. ${ctr_build_env_dir}/$${IMAGE_LIBCAMERA}.env
[ -v LIBCAMERA_VERSION_GIT_TAG_OVERRIDE ] && echo "LIBCAMERA_VERSION_GIT_TAG_OVERRIDE=$${LIBCAMERA_VERSION_GIT_TAG_OVERRIDE}"
hack/bin/podman-build.sh ${ctr_context_local_dir}/$${IMAGE_LIBCAMERA}
RPICAM_APPS_VERSION_TAG_OVERRIDE?=
export RPICAM_APPS_VERSION_TAG_OVERRIDE
container-build-rpicam-apps:
. ${ctr_build_constant_env_file}
. ${ctr_build_env_dir}/$${IMAGE_RPICAM_APPS}.env
[ -v RPICAM_APPS_VERSION_TAG_OVERRIDE ] && echo "RPICAM_APPS_VERSION_TAG_OVERRIDE=$${RPICAM_APPS_VERSION_TAG_OVERRIDE}"
hack/bin/podman-build.sh ${ctr_context_local_dir}/$${IMAGE_RPICAM_APPS}
FFMPEG_VERSION_TAG_OVERRIDE?=
export RPICAM_APPS_VERSION_TAG_OVERRIDE
container-build-ffmpeg:
. ${ctr_build_constant_env_file}
. ${ctr_build_env_dir}/$${IMAGE_FFMPEG}.env
[ -v FFMPEG_VERSION_TAG_OVERRIDE ] && echo "FFMPEG_VERSION_TAG_OVERRIDE=$${FFMPEG_VERSION_TAG_OVERRIDE}"
hack/bin/podman-build.sh ${ctr_context_local_dir}/$${IMAGE_FFMPEG}
MOTION_VERSION_OVERRIDE?=
export MOTION_VERSION_OVERRIDE
container-build-motion:
. ${ctr_build_constant_env_file}
. ${ctr_build_env_dir}/$${IMAGE_MOTION}.env
[ -v MOTION_VERSION_OVERRIDE ] && echo "MOTION_VERSION_OVERRIDE=$${MOTION_VERSION_OVERRIDE}"
hack/bin/podman-build.sh ${ctr_context_local_dir}/$${IMAGE_MOTION}
container-build-btrfs-progs:
. ${ctr_build_constant_env_file}
. ${ctr_build_env_dir}/$${IMAGE_BTRFS_PROGS}.env
hack/bin/podman-build.sh ${ctr_context_local_dir}/$${IMAGE_BTRFS_PROGS}
### Containerfile End ###