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

update to new methods

This commit is contained in:
JasonN3 2024-03-05 16:46:38 +00:00
parent 408da12b86
commit dad1aea23f
4 changed files with 42 additions and 31 deletions

View file

@ -21,7 +21,7 @@ _IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG) _VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
_REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS)) _REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS))
_LORAX_TEMPLATES = $(subst .in,,$(shell ls lorax_templates/*.tmpl.in)) $(foreach file,$(shell ls lorax_templates/scripts/post),lorax_templates/post_$(file).tmpl) _LORAX_TEMPLATES = $(subst .in,,$(shell ls lorax_templates/*.tmpl.in)) $(foreach file,$(shell ls lorax_templates/scripts/post),lorax_templates/post_$(file).tmpl)
_TEMPLATE_VARS = ARCH VERSION IMAGE_REPO IMAGE_NAME IMAGE_TAG VARIANT WEB_UI REPOS _IMAGE_REPO_ESCAPED _IMAGE_REPO_DOUBLE_ESCAPED _TEMPLATE_VARS = ARCH VERSION IMAGE_REPO IMAGE_NAME IMAGE_TAG VARIANT WEB_UI REPOS _IMAGE_REPO_ESCAPED _IMAGE_REPO_DOUBLE_ESCAPED ENROLLMENT_PASSWORD
ifeq ($(VARIANT),Server) ifeq ($(VARIANT),Server)
_LORAX_ARGS = --macboot --noupgrade _LORAX_ARGS = --macboot --noupgrade
@ -46,6 +46,7 @@ lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
$(eval _ISO_FILE = usr/share/anaconda/interactive-defaults.ks) $(eval _ISO_FILE = usr/share/anaconda/interactive-defaults.ks)
header=0; \ header=0; \
skip=0; \
while read -r line; \ while read -r line; \
do \ do \
if [[ $$line =~ ^\<\% ]]; \ if [[ $$line =~ ^\<\% ]]; \
@ -55,11 +56,21 @@ lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
else \ else \
if [[ $$header == 0 ]]; \ if [[ $$header == 0 ]]; \
then \ 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; \ echo "append $(_ISO_FILE) \"%post --erroronfail\"" >> lorax_templates/post_$*.tmpl; \
fi; \
header=1; \ header=1; \
fi; \ fi; \
if [[ $$skip == 0 ]]; \
then \
echo "append $(_ISO_FILE) \"$$line\"" >> lorax_templates/post_$*.tmpl; \ echo "append $(_ISO_FILE) \"$$line\"" >> lorax_templates/post_$*.tmpl; \
fi; \ fi; \
skip=0; \
fi; \
done < lorax_templates/scripts/post/$* done < lorax_templates/scripts/post/$*
echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl
@ -67,19 +78,31 @@ lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
$(eval _ISO_FILE = usr/share/anaconda/post-scripts/configure_upgrades.ks) $(eval _ISO_FILE = usr/share/anaconda/post-scripts/configure_upgrades.ks)
header=0; \ header=0; \
skip=0; \
while read -r line; \ while read -r line; \
do \ do \
if [[ $$line =~ ^\<\% ]]; \ if [[ $$line =~ ^\<\% ]]; \
then \ then \
echo $$line >> lorax_templates/post_$*.tmpl; \
echo >> lorax_templates/post_$*.tmpl; \ echo >> lorax_templates/post_$*.tmpl; \
else \ else \
if [[ $$header == 0 ]]; \ if [[ $$header == 0 ]]; \
then \ 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; \ echo "append $(_ISO_FILE) \"%post --erroronfail\"" >> lorax_templates/post_$*.tmpl; \
fi; \
header=1; \ header=1; \
fi; \ fi; \
if [[ $$skip == 0 ]]; \
then \
echo "append $(_ISO_FILE) \"$$line\"" >> lorax_templates/post_$*.tmpl; \ echo "append $(_ISO_FILE) \"$$line\"" >> lorax_templates/post_$*.tmpl; \
fi; \ fi; \
skip=0; \
fi; \
done < lorax_templates/scripts/post/$* done < lorax_templates/scripts/post/$*
echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl echo "append $(_ISO_FILE) \"%end\"" >> lorax_templates/post_$*.tmpl
@ -103,12 +126,10 @@ boot.iso: $(_LORAX_TEMPLATES) $(_REPO_FILES)
rm -Rf $(_BASE_DIR)/results || true rm -Rf $(_BASE_DIR)/results || true
rm /etc/rpm/macros.image-language-conf || true rm /etc/rpm/macros.image-language-conf || true
# Set the enrollment password
sed 's/@ENROLLMENT_PASSWORD@/$(ENROLLMENT_PASSWORD)/' $(_BASE_DIR)/scripts/enroll-secureboot-key.sh.in > $(_BASE_DIR)/scripts/enroll-secureboot-key.sh
# Download the secure boot key # Download the secure boot key
if [ -n "$(SECURE_BOOT_KEY_URL)" ]; then\ if [ -n "$(SECURE_BOOT_KEY_URL)" ]; \
curl --fail -L -o $(_BASE_DIR)/sb_pubkey.der $(SECURE_BOOT_KEY_URL);\ then \
curl --fail -L -o $(_BASE_DIR)/sb_pubkey.der $(SECURE_BOOT_KEY_URL); \
fi fi
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \ lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \

View file

@ -1,8 +1,9 @@
#!/bin/sh <%page args="enrollment_password "/>
## --nochroot
set -oue pipefail set -oue pipefail
readonly ENROLLMENT_PASSWORD=@ENROLLMENT_PASSWORD@ readonly ENROLLMENT_PASSWORD=${enrollment_password}
readonly SECUREBOOT_KEY="/run/install/repo/sb_pubkey.der" readonly SECUREBOOT_KEY="/run/install/repo/sb_pubkey.der"
if [[ ! -d "/sys/firmware/efi" ]]; then if [[ ! -d "/sys/firmware/efi" ]]; then

View file

@ -1,9 +0,0 @@
append usr/share/anaconda/interactive-defaults.ks "%post --logfile=/root/ks-post.log --erroronfail --nochroot"
append usr/share/anaconda/interactive-defaults.ks "set -m"
append usr/share/anaconda/interactive-defaults.ks "/run/install/repo/enroll-secureboot-key.sh"
append usr/share/anaconda/interactive-defaults.ks "%end"
append usr/share/anaconda/post-scripts/secure_boot_key.ks "%post --logfile=/root/ks-post.log --erroronfail --nochroot"
append usr/share/anaconda/post-scripts/secure_boot_key.ks "set -m"
append usr/share/anaconda/post-scripts/secure_boot_key.ks "/run/install/repo/enroll-secureboot-key.sh"
append usr/share/anaconda/post-scripts/secure_boot_key.ks "%end"

View file

@ -9,8 +9,6 @@ if [ -f $(pwd)/sb_pubkey.der ]; then
echo "-map $(pwd)/sb_pubkey.der sb_pubkey.der" echo "-map $(pwd)/sb_pubkey.der sb_pubkey.der"
echo "-chmod 0444 /sb_pubkey.der" echo "-chmod 0444 /sb_pubkey.der"
fi fi
echo "-map $(pwd)/scripts/enroll-secureboot-key.sh enroll-secureboot-key.sh"
echo "-chmod 0777 enroll-secureboot-key.sh"
pushd container >/dev/null pushd container >/dev/null
for file in $(find ${IMAGE_NAME}-${IMAGE_TAG}); do for file in $(find ${IMAGE_NAME}-${IMAGE_TAG}); do
echo "-map $(pwd)/${file} ${file}" echo "-map $(pwd)/${file} ${file}"