Skip to content

Commit

Permalink
Use the Lorax templates for the OS version (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonN3 authored Mar 12, 2024
1 parent 4710f30 commit f4fd878
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: 'true'

- name: Docker meta
id: meta
Expand All @@ -49,6 +51,7 @@ jobs:
with:
containerfiles: Containerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Push image
uses: redhat-actions/push-to-registry@v2
Expand All @@ -72,9 +75,11 @@ jobs:
version:
- 38
- 39
- 40
outputs:
iso_name-38: ${{ steps.save_output.outputs.iso_name-38 }}
iso_name-39: ${{ steps.save_output.outputs.iso_name-39 }}
iso_name-40: ${{ steps.save_output.outputs.iso_name-40 }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -141,6 +146,7 @@ jobs:
version:
- 38
- 39
- 40
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
path = external/fedora-lorax-templates
url = https://pagure.io/fedora-lorax-templates.git
branch = f39
[submodule "external/lorax"]
path = external/lorax
url = https://github.com/weldr/lorax.git
4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM fedora:39
FROM fedora:40

ARG VERSION=39
ARG VERSION=40

ENV ARCH="x86_64"
ENV IMAGE_NAME="base"
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ build/deploy.iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.t
xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt
implantisomd5 build/deploy.iso

lorax_repo:
git config advice.detachedHead false
cd external/lorax && git checkout tags/$(shell cd external/lorax && git tag -l lorax-$(VERSION).* --sort=creatordate | tail -n 1)

# Step 1: Generate Lorax Templates
lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
# Support interactive-defaults.ks
Expand Down Expand Up @@ -163,11 +167,9 @@ repos/%.repo: /etc/yum.repos.d/%.repo
%.repo:

# Step 3: Build boot.iso using Lorax
boot.iso: $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES)
boot.iso: lorax_repo $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES)
rm -Rf $(_BASE_DIR)/results || true
mv /etc/rpm/macros.image-language-conf $(_TEMP_DIR)/macros.image-language-conf || true
cp /etc/os-release $(_TEMP_DIR)/os-release || true
sed -i 's/PLATFORM_ID=.*/PLATFORM_ID="$(_PLATFORM_ID)"/' /etc/os-release

# Download the secure boot key
if [ -n "$(SECURE_BOOT_KEY_URL)" ]; \
Expand All @@ -176,7 +178,7 @@ boot.iso: $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES)
fi

lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
--isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) \
--isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(_BASE_DIR)/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)) \
Expand All @@ -188,7 +190,6 @@ boot.iso: $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES)
$(_BASE_DIR)/results/
mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/
mv -f $(_TEMP_DIR)/macros.image-language-conf /etc/rpm/macros.image-language-conf || true
mv -f $(_TEMP_DIR)/os-release /etc/os-release || true

# Step 4: Download container image
container/$(IMAGE_NAME)-$(IMAGE_TAG):
Expand Down Expand Up @@ -223,7 +224,7 @@ clean:
rm -f $(_BASE_DIR)/*.log || true

install-deps:
dnf install -y lorax xorriso skopeo flatpak dbus-daemon ostree coreutils gettext
dnf install -y lorax xorriso skopeo flatpak dbus-daemon ostree coreutils gettext git

test: test-iso test-vm

Expand Down Expand Up @@ -253,4 +254,4 @@ test-vm:
chmod +x $(foreach test,$(_TESTS),tests/vm/$(test))
for test in $(_TESTS); do ./tests/vm/$${test} deploy.iso; done

.PHONY: clean install-deps test test-iso test-vm container/$(IMAGE_NAME)-$(IMAGE_TAG)
.PHONY: clean install-deps test test-iso test-vm lorax_repo
1 change: 1 addition & 0 deletions external/lorax
Submodule lorax added at ffba30

0 comments on commit f4fd878

Please # to comment.