umorpha-boxes/Makefile

67 lines
2.2 KiB
Makefile
Raw Normal View History

2023-10-28 20:37:09 +00:00
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
2023-11-08 05:07:45 +00:00
SHELL = bash
2023-10-28 20:37:09 +00:00
export osi_tools = $(CURDIR)/../notsystemd-tests
PATH := $(osi_tools):$(PATH)
2023-10-31 23:18:47 +00:00
all: $(patsubst %.sh,%.rootfs.img,$(wildcard images/*.sh))
2023-10-28 20:37:09 +00:00
.PHONY: all
2023-10-31 23:18:47 +00:00
.SECONDARY:
.DELETE_ON_ERROR:
################################################################################
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,' >$@
2023-10-28 20:37:09 +00:00
-include deps.mk
2023-10-31 23:18:47 +00:00
images/%.rootfs.img: images/%.sh
2023-10-28 20:37:09 +00:00
rm -f $@
$< $@
2023-10-28 22:12:25 +00:00
chmod 444 $@
2023-10-31 23:18:47 +00:00
images/%.gpt.img: images/%.rootfs.img bin/umorpha-install
rm -f $@
truncate --size=3G $@
2023-11-09 21:55:25 +00:00
sudo bin/umorpha-install images/$*.rootfs.img $@
2023-10-31 23:18:47 +00:00
2023-11-08 05:07:45 +00:00
images/%.bootstrap.iso: images/%.rootfs.img images/bootstrap.rootfs.img bin/mkbootstrapiso
bin/mkbootstrapiso $< $@
run/%.gpt.img: images/%.gpt.img
2023-10-31 23:18:47 +00:00
qemu-system-x86_64 \
-accel kvm \
-m 2G \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/ovmf/x64/OVMF.fd \
2023-11-08 05:07:45 +00:00
-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 \
2023-10-31 23:18:47 +00:00
-net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8080-:80 -net nic
2023-10-28 22:12:25 +00:00
.PHONY: run/%
2023-10-28 20:37:09 +00:00
2023-11-08 22:02:54 +00:00
deploy/%: images/%.bootstrap.iso vultr/%.sh
2023-11-04 02:28:14 +00:00
vultr/$*.sh
.PHONY: deploy/%
2023-10-31 23:18:47 +00:00
################################################################################
2023-11-08 05:07:45 +00:00
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 >$@
2023-10-31 16:26:46 +00:00
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" \
2023-10-31 23:18:47 +00:00
<modules/service-gitea.sh.in >$@