2022-03-06 05:20:56 -05:00
|
|
|
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2023-08-31 11:25:01 +02:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-02-17 12:23:15 +01:00
|
|
|
NAME ?= VILLASlive
|
2022-03-06 05:20:56 -05:00
|
|
|
RELEASEVER ?= 35
|
2020-02-17 12:23:15 +01:00
|
|
|
RELEASEARCH ?= x86_64
|
|
|
|
DATE = $(shell date +%Y-%m-%d)
|
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
DEPLOY_PATH ?= https://files.fein-aachen.org/
|
|
|
|
DEPLOY_USER ?= webdav
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
ifneq ($(CI),)
|
|
|
|
VERSION = $(CI_COMMIT_REF_NAME)
|
|
|
|
else
|
|
|
|
VERSION = $(shell git describe --tags)
|
|
|
|
endif
|
|
|
|
|
|
|
|
BASE = $(NAME)-$(RELEASEARCH)-$(RELEASEVER)
|
|
|
|
IMG = $(BASE)-$(VERSION:v%=%).img
|
|
|
|
IMG_LATEST = $(BASE)-latest.iso
|
2022-03-06 05:20:56 -05:00
|
|
|
|
|
|
|
BASE_ISO=Fedora-Server-netinst-$(RELEASEARCH)-$(RELEASEVER)-1.2.iso
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
SRCDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
|
|
BUILDDIR ?= $(SRCDIR)/build
|
|
|
|
|
|
|
|
export BUILDDIR
|
|
|
|
|
|
|
|
FILES = $(shell find $(SRCDIR)/files -type f)
|
|
|
|
PATCHED_FILES = $(FILES:$(SRCDIR)/files/%=$(BUILDDIR)/patched_files/%)
|
|
|
|
|
|
|
|
# Tools
|
2022-03-06 05:20:56 -05:00
|
|
|
LMC = livemedia-creator \
|
|
|
|
--releasever=$(RELEASEVER) \
|
|
|
|
--ram=8192 \
|
|
|
|
--vcpus=16
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
# Targets
|
2022-03-06 05:20:56 -05:00
|
|
|
all: iso
|
|
|
|
iso: $(BUILDDIR)/$(ISO)
|
|
|
|
|
|
|
|
patched: $(PATCHED_FILES)
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BUILDDIR)
|
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
deploy: #$(BUILDDIR)/$(ISO)
|
|
|
|
rclone config create fein webdav url ${DEPLOY_PATH} vendor other user ${DEPLOY_USER} pass ${DEPLOY_PASS}
|
|
|
|
rclone config show
|
|
|
|
rclone copy $(BUILDDIR)/$(ISO) fein:villas/iso
|
2020-02-17 12:23:15 +01:00
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
$(BUILDDIR)/$(ISO): $(BUILDDIR)/iso/villas.iso
|
2020-02-17 12:23:15 +01:00
|
|
|
ln -s $< $@
|
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
$(BUILDDIR)/iso/%.iso: $(SRCDIR)/%.ks /tmp/$(BASE_ISO)
|
2020-02-17 12:23:15 +01:00
|
|
|
# livemedia-creator requires that the resultdir is not present
|
|
|
|
rm -rf $(dir $@)
|
|
|
|
|
|
|
|
# livemedia-creator uses losetup to mount the image
|
|
|
|
# When used in a Docker container, we must make sure
|
|
|
|
# that there are some usable /dev/loopX devices.
|
|
|
|
./ensure_loop.sh
|
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
$(LMC) \
|
|
|
|
--make-iso \
|
|
|
|
--iso-only \
|
|
|
|
--iso-name=$(notdir $@) \
|
|
|
|
--iso /tmp/$(BASE_ISO) \
|
|
|
|
--resultdir=$(dir $@) \
|
|
|
|
--kernel-args "inst.ks=file:/villas.ks" \
|
|
|
|
--ks $<
|
2020-02-17 12:23:15 +01:00
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
/tmp/$(BASE_ISO):
|
|
|
|
wget -nv -O $@ https://ftp.halifax.rwth-aachen.de/fedora/linux/releases/$(RELEASEVER)/Server/$(RELEASEARCH)/iso/$(BASE_ISO)
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
$(BUILDDIR)/patched_files/%: $(SRCDIR)/files/%
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
sed -e "s/§VERSION§/$(VERSION)/g" \
|
|
|
|
-e "s/§RELEASEVER§/$(RELEASEVER)/g" \
|
|
|
|
-e "s/§RELEASEARCH§/$(RELEASEARCH)/g" \
|
|
|
|
-e "s/§DATE§/$(DATE)/g" < $< > $@
|
|
|
|
|
2022-03-06 05:20:56 -05:00
|
|
|
.PHONY: all deploy clean deploy patched iso
|
2020-02-17 12:23:15 +01:00
|
|
|
|
|
|
|
.PRECIOUS: %
|