79 lines
2.6 KiB
Makefile
79 lines
2.6 KiB
Makefile
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
SHELL = bash
|
|
export osi_tools = $(CURDIR)/../notsystemd-tests
|
|
PATH := $(osi_tools):$(PATH)
|
|
|
|
all: $(patsubst %.sh,%.rootfs.img,$(wildcard images/*.sh))
|
|
.PHONY: all
|
|
|
|
.SECONDARY:
|
|
.DELETE_ON_ERROR:
|
|
|
|
# Nothing here is parallel-unsafe, but it just makes the output (and
|
|
# especially `sudo` prompts) hard to read.
|
|
.NOTPARALLEL:
|
|
|
|
################################################################################
|
|
|
|
deps.mk: images $(wildcard images/*.sh)
|
|
grep -H -o -e '--module=\S*' images/*.sh | sed -E 's,images/([^:]*).sh:--module=(.*),images/\1.rootfs.img: \2,' >$@
|
|
-include deps.mk
|
|
|
|
images/%.rootfs.img: images/%.sh
|
|
rm -f $@
|
|
$< $@
|
|
chmod 444 $@
|
|
|
|
images/%.gpt.img: images/%.rootfs.img bin/umorpha-install
|
|
rm -f $@
|
|
truncate --size=3G $@
|
|
sudo bin/umorpha-install images/$*.rootfs.img $@
|
|
|
|
images/%.bootstrap.iso: images/%.rootfs.img images/bootstrap.rootfs.img bin/mkbootstrapiso
|
|
bin/mkbootstrapiso $< $@
|
|
|
|
run/%.rootfs.img: images/%.rootfs.img
|
|
cp --reflink -- images/$*.rootfs.img images/$*.rootfs.tmp.img
|
|
chmod 644 -- images/$*.rootfs.tmp.img
|
|
qemu-system-x86_64 \
|
|
-accel kvm \
|
|
-m 2G \
|
|
-drive media=disk,if=virtio,format=raw,file=images/$*.rootfs.tmp.img \
|
|
-net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8080-:80 -net nic
|
|
run/%.gpt.img: images/%.gpt.img
|
|
qemu-system-x86_64 \
|
|
-accel kvm \
|
|
-m 2G \
|
|
-drive if=pflash,format=raw,readonly=on,file=/usr/share/ovmf/x64/OVMF.fd \
|
|
-drive media=disk,if=virtio,format=raw,file=images/$*.gpt.img \
|
|
-net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8080-:80 -net nic
|
|
run/%.bootstrap.iso: images/%.bootstrap.iso
|
|
truncate --size=3G images/$*.bootstrap.img
|
|
qemu-system-x86_64 \
|
|
-accel kvm \
|
|
-m 2G \
|
|
-drive media=disk,if=virtio,format=raw,file=images/$*.bootstrap.img \
|
|
-cdrom images/$*.bootstrap.iso \
|
|
-net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8080-:80 -net nic
|
|
.PHONY: run/%
|
|
|
|
deploy/%: images/%.bootstrap.iso vultr/%.sh
|
|
vultr/$*.sh
|
|
.PHONY: deploy/%
|
|
|
|
################################################################################
|
|
|
|
modules/umorpha-bootstrap.sh: modules/umorpha-bootstrap.sh.in
|
|
modules/umorpha-bootstrap.sh: bin/umorpha-install
|
|
sed $$'/@UMORPHA_INSTALL_CONTENT@/{\nr bin/umorpha-install\nd\n}' <modules/umorpha-bootstrap.sh.in >$@
|
|
|
|
modules/service-gitea.sh: modules/service-gitea.sh.in
|
|
modules/service-gitea.sh: secrets/gitea-infomaniak-clientid.txt
|
|
modules/service-gitea.sh: secrets/gitea-infomaniak-clientsecret.txt
|
|
sed \
|
|
-e "s,@CLIENT_ID@,$$(cat secrets/gitea-infomaniak-clientid.txt),g" \
|
|
-e "s,@CLIENT_SECRET@,$$(cat secrets/gitea-infomaniak-clientsecret.txt),g" \
|
|
<modules/service-gitea.sh.in >$@
|