mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
dynamically generate template
This commit is contained in:
parent
d6d8536caf
commit
3b727b819f
3 changed files with 20 additions and 36 deletions
32
Makefile
32
Makefile
|
|
@ -27,7 +27,7 @@ export install_pkg
|
||||||
_IMAGE_REPO_ESCAPED := $(subst /,\/,$(IMAGE_REPO))
|
_IMAGE_REPO_ESCAPED := $(subst /,\/,$(IMAGE_REPO))
|
||||||
_IMAGE_REPO_DOUBLE_ESCAPED := $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
_IMAGE_REPO_DOUBLE_ESCAPED := $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||||
_LORAX_ARGS :=
|
_LORAX_ARGS :=
|
||||||
_LORAX_TEMPLATES := $(call get_templates,install)
|
export _LORAX_TEMPLATES := $(call get_templates,install) install_include_post.tmpl
|
||||||
_REPO_FILES := $(subst /etc/yum.repos.d,repos,$(REPOS))
|
_REPO_FILES := $(subst /etc/yum.repos.d,repos,$(REPOS))
|
||||||
_TEMP_DIR := $(shell mktemp -d)
|
_TEMP_DIR := $(shell mktemp -d)
|
||||||
_TEMPLATE_VARS := ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_SIGNED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI
|
_TEMPLATE_VARS := ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_SIGNED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI
|
||||||
|
|
@ -35,7 +35,7 @@ _VOLID := $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(
|
||||||
|
|
||||||
ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo)
|
ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo)
|
||||||
export _RHEL := true
|
export _RHEL := true
|
||||||
_LORAX_TEMPLATES += $(call get_templates,rhel)
|
export _LORAX_TEMPLATES += $(call get_templates,rhel)
|
||||||
else
|
else
|
||||||
undefine _RHEL
|
undefine _RHEL
|
||||||
endif
|
endif
|
||||||
|
|
@ -53,17 +53,17 @@ _LORAX_ARGS += -i anaconda-webui
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(DNF_CACHE),)
|
ifneq ($(DNF_CACHE),)
|
||||||
_LORAX_ARGS += --cachedir $(DNF_CACHE)
|
_LORAX_ARGS += --cachedir $(DNF_CACHE)
|
||||||
_LORAX_TEMPLATES += $(call get_templates,cache)
|
export _LORAX_TEMPLATES += $(call get_templates,cache)
|
||||||
_TEMPLATE_VARS += DNF_CACHE
|
_TEMPLATE_VARS += DNF_CACHE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(FLATPAK_DIR),)
|
ifneq ($(FLATPAK_DIR),)
|
||||||
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
||||||
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
||||||
_LORAX_ARGS += -i flatpak-libs
|
_LORAX_ARGS += -i flatpak-libs
|
||||||
_LORAX_TEMPLATES += $(call get_templates,flatpak)
|
export _LORAX_TEMPLATES += $(call get_templates,flatpak)
|
||||||
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
||||||
else
|
else
|
||||||
ifneq ($(FLATPAK_REMOTE_REFS_DIR),)
|
ifneq ($(FLATPAK_REMOTE_REFS_DIR),)
|
||||||
COLLECTED_REFS := $(foreach file,$(filter-out README.md Makefile,$(wildcard $(FLATPAK_REMOTE_REFS_DIR)/*)),$(shell cat $(file)))
|
COLLECTED_REFS := $(foreach file,$(filter-out README.md Makefile,$(wildcard $(FLATPAK_REMOTE_REFS_DIR)/*)),$(shell cat $(file)))
|
||||||
|
|
@ -71,19 +71,19 @@ export FLATPAK_REMOTE_REFS += $(sort $(COLLECTED_REFS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(FLATPAK_REMOTE_REFS),)
|
ifneq ($(FLATPAK_REMOTE_REFS),)
|
||||||
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
||||||
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
||||||
_LORAX_ARGS += -i flatpak-libs
|
_LORAX_ARGS += -i flatpak-libs
|
||||||
_LORAX_TEMPLATES += $(call get_templates,flatpak) \
|
export _LORAX_TEMPLATES += $(call get_templates,flatpak) \
|
||||||
external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl
|
external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl
|
||||||
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(SECURE_BOOT_KEY_URL),)
|
ifneq ($(SECURE_BOOT_KEY_URL),)
|
||||||
_LORAX_TEMPLATES += $(call get_templates,secureboot)
|
export _LORAX_TEMPLATES += $(call get_templates,secureboot)
|
||||||
_TEMPLATE_VARS += ENROLLMENT_PASSWORD
|
_TEMPLATE_VARS += ENROLLMENT_PASSWORD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
_SUBDIRS := container external flatpak_refs lorax_templates repos xorriso test
|
_SUBDIRS := container external flatpak_refs lorax_templates repos xorriso test
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ endef
|
||||||
post_%.tmpl: scripts/post/%
|
post_%.tmpl: scripts/post/%
|
||||||
$(call convert_post_to_tmpl,$*,usr/share/anaconda/post-scripts/$*.ks,true)
|
$(call convert_post_to_tmpl,$*,usr/share/anaconda/post-scripts/$*.ks,true)
|
||||||
|
|
||||||
|
install_include_post.tmpl:
|
||||||
|
echo '<%page />' > install_include_post.tmpl
|
||||||
|
for file in $(patsubst post_%.tmpl, %, $(filter post_%, $(notdir $(_LORAX_TEMPLATES)))); do echo "append usr/share/anaconda/interactive-defaults.ks \"%include /usr/share/anaconda/post-scripts/$${file}.ks\"" >> install_include_post.tmpl; done
|
||||||
|
|
||||||
install-deps:
|
install-deps:
|
||||||
|
|
||||||
FILES=$(wildcard post_*)
|
FILES=$(wildcard post_*)
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
<%page args="version"/>
|
|
||||||
|
|
||||||
<%
|
|
||||||
import os
|
|
||||||
def list_files(directory):
|
|
||||||
try:
|
|
||||||
files = os.listdir(directory)
|
|
||||||
return files
|
|
||||||
except OSError as e:
|
|
||||||
return [f"Error: {e}"] # Return error message as a list
|
|
||||||
|
|
||||||
directory_to_list = "scripts/post"
|
|
||||||
file_list = list_files(directory_to_list)
|
|
||||||
%>
|
|
||||||
|
|
||||||
% if int(version) >= 42:
|
|
||||||
% for file_name in file_list:
|
|
||||||
append usr/share/anaconda/interactive-defaults.ks "%include /usr/share/anaconda/post-scripts/${file_name}.ks"
|
|
||||||
% endfor
|
|
||||||
% endif
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue