diff --git a/Makefile b/Makefile index 5a48d81..6633f76 100644 --- a/Makefile +++ b/Makefile @@ -24,14 +24,13 @@ export install_pkg # Generated/internal vars ## Formatting = _UPPERCASE -export _BASE_DIR := $(shell pwd) _IMAGE_REPO_ESCAPED := $(subst /,\/,$(IMAGE_REPO)) _IMAGE_REPO_DOUBLE_ESCAPED := $(subst \,\\\,$(_IMAGE_REPO_ESCAPED)) _LORAX_ARGS := _LORAX_TEMPLATES := $(call get_templates,install) _REPO_FILES := $(subst /etc/yum.repos.d,repos,$(REPOS)) _TEMP_DIR := $(shell mktemp -d) -_TEMPLATE_VARS := ARCH _BASE_DIR IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI +_TEMPLATE_VARS := ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI _VOLID := $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG) ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo) @@ -96,30 +95,31 @@ $(ISO_NAME)-CHECKSUM: $(ISO_NAME) # Build end ISO $(ISO_NAME): results/images/boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt $(if $(wildcard $(dir $(ISO_NAME))),,mkdir -p $(dir $(ISO_NAME)); chmod ugo=rwX $(dir $(ISO_NAME))) - xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt + xorriso -dialog on < xorriso/input.txt implantisomd5 $(ISO_NAME) chmod ugo=r $(ISO_NAME) $(if $(GITHUB_OUTPUT), echo "iso_name=$(ISO_NAME)" >> $(GITUHB_OUTPUT)) +# Download the secure boot key +sb_pubkey.der: + curl --fail -L -o sb_pubkey.der $(SECURE_BOOT_KEY_URL) + # Build boot.iso using Lorax -results/images/boot.iso: external/lorax/branch-$(VERSION) $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES) +results/images/boot.iso: external/lorax/branch-$(VERSION) $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES) $(if $(SECURE_BOOT_KEY_URL),sb_pubkey.der) $(if $(wildcard results), rm -Rf results) $(if $(wildcard /etc/rpm/macros.image-language-conf),mv /etc/rpm/macros.image-language-conf $(_TEMP_DIR)/macros.image-language-conf) -# Download the secure boot key - $(if $(SECURE_BOOT_KEY_URL), curl --fail -L -o $(_BASE_DIR)/sb_pubkey.der $(SECURE_BOOT_KEY_URL)) - lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \ - --isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(_BASE_DIR)/external/lorax/share/templates.d/99-generic \ + --isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(PWD)/external/lorax/share/templates.d/99-generic \ $(_LORAX_ARGS) \ - $(foreach file,$(_REPO_FILES),--repo $(_BASE_DIR)/$(file)) \ - $(foreach file,$(_LORAX_TEMPLATES),--add-template $(_BASE_DIR)/$(file)) \ + $(foreach file,$(_REPO_FILES),--repo $(PWD)/$(file)) \ + $(foreach file,$(_LORAX_TEMPLATES),--add-template $(PWD)/$(file)) \ $(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \ $(foreach file,$(_FLATPAK_TEMPLATES),--add-template $(file)) \ - $(foreach file,$(_EXTERNAL_TEMPLATES),--add-template $(_BASE_DIR)/external/$(file)) \ + $(foreach file,$(_EXTERNAL_TEMPLATES),--add-template $(PWD)/external/$(file)) \ --rootfs-size $(ROOTFS_SIZE) \ $(foreach var,$(_TEMPLATE_VARS),--add-template-var "$(shell echo $(var) | tr '[:upper:]' '[:lower:]')=$($(var))") \ - $(_BASE_DIR)/results/ + results/ $(if $(wildcard $(_TEMP_DIR)/macros.image-language-conf),mv -f $(_TEMP_DIR)/macros.image-language-conf /etc/rpm/macros.image-language-conf) diff --git a/test/iso/Makefile b/test/iso/Makefile index b154ec6..3f3f76f 100644 --- a/test/iso/Makefile +++ b/test/iso/Makefile @@ -17,7 +17,7 @@ mnt/iso: clean: sudo umount mnt/install || true sudo umount mnt/iso || true - sudo rmdir mnt/install /mnt/iso + sudo rmdir mnt/install mnt/iso install-deps: $(install_pkg) isomd5sum coreutils squashfs-tools curl diff --git a/xorriso/Makefile b/xorriso/Makefile index 15129cf..65b8b2a 100644 --- a/xorriso/Makefile +++ b/xorriso/Makefile @@ -1,7 +1,7 @@ input.txt: gen_input.sh sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/boot/grub2/grub.cfg sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/EFI/BOOT/grub.cfg - $(eval _VARS = ARCH _BASE_DIR FLATPAK_DIR IMAGE_NAME IMAGE_TAG ISO_NAME VERSION) + $(eval _VARS = ARCH FLATPAK_DIR IMAGE_NAME IMAGE_TAG ISO_NAME VERSION) $(foreach var,$(_VARS),$(var)=$($(var))) bash gen_input.sh | tee input.txt install-deps: diff --git a/xorriso/gen_input.sh b/xorriso/gen_input.sh index 1fdae36..3a96582 100644 --- a/xorriso/gen_input.sh +++ b/xorriso/gen_input.sh @@ -1,19 +1,19 @@ #!/bin/bash echo "-report_about WARNING" -echo "-indev ${_BASE_DIR}/results/images/boot.iso" +echo "-indev ${PWD}/results/images/boot.iso" echo "-outdev ${ISO_NAME}" echo "-boot_image any replay" echo "-joliet on" echo "-compliance joliet_long_names" -#pushd ${_BASE_DIR}/results > /dev/null +#pushd ${PWD}/results > /dev/null #for file in $(find * -type f) #do # if [[ "$file" == "images/boot.iso" ]] # then # continue # fi -# echo "-map ${_BASE_DIR}/results/${file} ${file}" +# echo "-map ${PWD}/results/${file} ${file}" # echo "-chmod 0444 ${file}" #done #popd > /dev/null @@ -35,7 +35,7 @@ then echo "-chmod 0444 /sb_pubkey.der" fi -pushd ${_BASE_DIR}/container > /dev/null +pushd ${PWD}/container > /dev/null for file in $(find ${IMAGE_NAME}-${IMAGE_TAG} -type f) do echo "-map $(pwd)/${file} ${file}"