1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 19:07:54 +01:00

only run some actions for 38

This commit is contained in:
Jason N. 2024-03-13 10:36:19 -04:00
parent 6f1f78fa89
commit c3e7518310
3 changed files with 52 additions and 70 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
/debugdata /debugdata
/build /build
/lorax_templates/post_*
/pkglists /pkglists
/repos /repos
/results /results

117
Makefile
View file

@ -23,14 +23,56 @@ SECURE_BOOT_KEY_URL =
# Cache # Cache
DNF_CACHE = DNF_CACHE =
# Functions
## Formatting = lowercase
# Get a list of templates for the feature
# $1 = feature
get_templates = $(shell ls lorax_templates/$(1)_*.tmpl) \
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
# Converts a post script to a template
# $1 = script to convert
# $2 = file on ISO to write
# $3 = whether to copy the '<%' lines to the template
convert_post_to_tmpl = header=0; \
skip=0; \
while read -r line; \
do \
if [[ $$line =~ ^\<\% ]]; \
then \
if [[ '$(3)' == 'true' ]]; \
then \
echo $$line >> lorax_templates/post_$(1).tmpl; \
fi; \
echo >> lorax_templates/post_$(1).tmpl; \
else \
if [[ $$header == 0 ]]; \
then \
if [[ $$line =~ ^\#\#\ (.*)$$ ]]; \
then \
echo "append $(2) \"%post --erroronfail $${BASH_REMATCH[1]}\"" >> lorax_templates/post_$(1).tmpl; \
skip=1; \
else \
echo "append $(2) \"%post --erroronfail\"" >> lorax_templates/post_$(1).tmpl; \
fi; \
header=1; \
fi; \
if [[ $$skip == 0 ]]; \
then \
echo "append $(2) \"$${line//\"/\\\"}\"" >> lorax_templates/post_$(1).tmpl; \
fi; \
skip=0; \
fi; \
done < lorax_templates/scripts/post/$(1); \
echo "append $(2) \"%end\"" >> lorax_templates/post_$(1).tmpl
# Generated/internal vars # Generated/internal vars
## Formatting = _UPPERCASE ## Formatting = _UPPERCASE
_BASE_DIR = $(shell pwd) _BASE_DIR = $(shell pwd)
_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 = $(shell ls lorax_templates/install_*.tmpl) \ _LORAX_TEMPLATES = $(call get_templates,install)
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/install_*)),lorax_templates/post_$(file).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_TAG REPOS VARIANT VERSION WEB_UI _TEMPLATE_VARS = ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_TAG REPOS VARIANT VERSION WEB_UI
@ -50,8 +92,7 @@ endif
ifneq ($(DNF_CACHE),) ifneq ($(DNF_CACHE),)
_LORAX_ARGS += --cachedir $(DNF_CACHE) _LORAX_ARGS += --cachedir $(DNF_CACHE)
_LORAX_TEMPLATES += $(shell ls lorax_templates/cache_*.tmpl) \ _LORAX_TEMPLATES += $(call get_templates,cache)
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/cache_*)),lorax_templates/post_$(file).tmpl)
_TEMPLATE_VARS += DNF_CACHE _TEMPLATE_VARS += DNF_CACHE
endif endif
@ -70,16 +111,14 @@ 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)
_FLATPAK_REPO_URL = $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2) _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 += $(shell ls lorax_templates/flatpak_*.tmpl) \ _LORAX_TEMPLATES += $(call get_templates,flatpak) \
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/flatpak_*)),lorax_templates/post_$(file).tmpl) \
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_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL _TEMPLATE_VARS += FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
endif endif
ifneq ($(SECURE_BOOT_KEY_URL),) ifneq ($(SECURE_BOOT_KEY_URL),)
_LORAX_TEMPLATES += $(shell ls lorax_templates/secureboot_*.tmpl) \ _LORAX_TEMPLATES += $(call get_templates,secureboot)
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/secureboot_*)),lorax_templates/post_$(file).tmpl)
_TEMPLATE_VARS += ENROLLMENT_PASSWORD _TEMPLATE_VARS += ENROLLMENT_PASSWORD
endif endif
@ -97,68 +136,10 @@ lorax_repo:
# Step 1: Generate Lorax Templates # Step 1: Generate Lorax Templates
lorax_templates/post_%.tmpl: lorax_templates/scripts/post/% lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
# Support interactive-defaults.ks # Support interactive-defaults.ks
$(eval _ISO_FILE = usr/share/anaconda/interactive-defaults.ks) [ $(VERSION) -le 38 ] && $(call convert_post_to_tmpl,$*,usr/share/anaconda/interactive-defaults.ks,true)
header=0; \
skip=0; \
while read -r line; \
do \
if [[ $$line =~ ^\<\% ]]; \
then \
echo $$line >> lorax_templates/post_$*.tmpl; \
echo >> lorax_templates/post_$*.tmpl; \
else \
if [[ $$header == 0 ]]; \
then \
if [[ $$line =~ ^##\ (.*)$$ ]]; \
then \
echo "append $(_ISO_FILE) \"%post --erroronfail $${BASH_REMATCH[1]}\"" >> lorax_templates/post_$*.tmpl; \
skip=1; \
else \
echo "append $(_ISO_FILE) \"%post --erroronfail\"" >> lorax_templates/post_$*.tmpl; \
fi; \
header=1; \
fi; \
if [[ $$skip == 0 ]]; \
then \
echo "append $(_ISO_FILE) \"$${line//\"/\\\"}\"" >> lorax_templates/post_$*.tmpl; \
fi; \
skip=0; \
fi; \
done < lorax_templates/scripts/post/$*
echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl
# Support new Anaconda method # Support new Anaconda method
$(eval _ISO_FILE = usr/share/anaconda/post-scripts/configure_upgrades.ks) [ $(VERSION) -ge 39 ] && $(call convert_post_to_tmpl,$*,usr/share/anaconda/post-scripts/$*.sh)
header=0; \
skip=0; \
while read -r line; \
do \
if [[ $$line =~ ^\<\% ]]; \
then \
echo >> lorax_templates/post_$*.tmpl; \
else \
if [[ $$header == 0 ]]; \
then \
if [[ $$line =~ ^##\ (.*)$$ ]]; \
then \
echo "append $(_ISO_FILE) \"%post --erroronfail $${BASH_REMATCH[1]}\"" >> lorax_templates/post_$*.tmpl; \
skip=1; \
else \
echo "append $(_ISO_FILE) \"%post --erroronfail\"" >> lorax_templates/post_$*.tmpl; \
fi; \
header=1; \
fi; \
if [[ $$skip == 0 ]]; \
then \
echo "append $(_ISO_FILE) \"$${line//\"/\\\"}\"" >> lorax_templates/post_$*.tmpl; \
fi; \
skip=0; \
fi; \
done < lorax_templates/scripts/post/$*
echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl
repos: $(_REPO_FILES) repos: $(_REPO_FILES)

View file

@ -1,5 +1,5 @@
<%page args="image_repo, _image_repo_double_escaped, image_name, image_tag"/> <%page args="image_repo, _image_repo_double_escaped, image_name, image_tag, version"/>
if (which bootc &> /dev/null) if (which bootc &> /dev/null) && [ ${version} -ge 39 ]
then then
bootc switch --mutate-in-place --enforce-container-sigpolicy --transport registry ${image_repo}/${image_name}:${image_tag} bootc switch --mutate-in-place --enforce-container-sigpolicy --transport registry ${image_repo}/${image_name}:${image_tag}
else else