From d8f9645e6f14b52e56912c21f0116e7cdc8c370c Mon Sep 17 00:00:00 2001 From: "Jason N." <33561705+JasonN3@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:51:46 -0500 Subject: [PATCH] use upstream --- .github/workflows/build-and-test.yml | 2 + .gitmodules | 4 ++ Makefile | 2 + lorax_templates/download_flatpaks.tmpl.in | 51 ----------------------- 4 files changed, 8 insertions(+), 51 deletions(-) create mode 100644 .gitmodules delete mode 100644 lorax_templates/download_flatpaks.tmpl.in diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7964b6a..fedeeb4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -134,6 +134,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 + with: + submodules: recursive - name: Ensure qemu is installed run: | diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fe51240 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "external/fedora-lorax-templates"] + path = external/fedora-lorax-templates + url = https://pagure.io/fedora-lorax-templates.git + branch = f39 diff --git a/Makefile b/Makefile index 80cfe69..fdbe848 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ _IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED)) _VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG) _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) +_EXTERNAL_TEMPLATES = external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl _FLATPAK_REPO_URL = $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2) _FLATPAK_REPO_GPG = $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2) _TEMPLATE_VARS = ARCH VERSION IMAGE_REPO IMAGE_NAME IMAGE_TAG VARIANT WEB_UI REPOS _IMAGE_REPO_ESCAPED _IMAGE_REPO_DOUBLE_ESCAPED FLATPAK_REMOTE_NAME FLATPAK_REMOTE_URL FLATPAK_REMOTE_REFS _FLATPAK_REPO_URL _FLATPAK_REPO_GPG ENROLLMENT_PASSWORD @@ -148,6 +149,7 @@ boot.iso: $(_LORAX_TEMPLATES) $(_REPO_FILES) $(foreach file,$(_LORAX_TEMPLATES),--add-template $(_BASE_DIR)/$(file)) \ $(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \ $(foreach file,$(_FLATPAK_TEMPLATES),--add-template $(file)) \ + $(foreach file,$(_EXTERNAL_TEMPLATES),--add-template $(file)) \ --rootfs-size $(ROOTFS_SIZE) \ $(foreach var,$(_TEMPLATE_VARS),--add-template-var "$(shell echo $(var) | tr '[:upper:]' '[:lower:]')=$($(var))") \ $(_BASE_DIR)/results/ diff --git a/lorax_templates/download_flatpaks.tmpl.in b/lorax_templates/download_flatpaks.tmpl.in deleted file mode 100644 index 1d7dcfe..0000000 --- a/lorax_templates/download_flatpaks.tmpl.in +++ /dev/null @@ -1,51 +0,0 @@ -## Lorax template to embed Flatpaks into the installer.iso - -## Args: -## - root - the root directory of the iso tree -## - flatpak_remote_name - the name for the flaptak remote to fetch from -## - flatpak_remote_url - the url for the remote -## - flatpak_remote_refs - refs to fetch from the remote (whitespace separated) - -<%page args="root, flatpak_remote_name, flatpak_remote_url, flatpak_remote_refs"/> -<% -import os -import re -import tempfile -import subprocess -from pylorax.executils import runcmd_output, setenv -from pylorax.sysutils import joinpaths - -dest_repo=joinpaths(root, "flatpak/repo") -refs=re.split(r"\s+", flatpak_remote_refs) - -# the temporary Flatpak directory is a sibling of the install tree -flatpak_dir=joinpaths(os.path.dirname(root), "flatpak") -setenv("FLATPAK_USER_DIR", flatpak_dir) -flatpak_repo=joinpaths(flatpak_dir, "repo") -# suppress executing triggers by using an empty directory -triggers_dir = tempfile.mkdtemp(prefix='flatpak-triggers-') -setenv("FLATPAK_TRIGGERSDIR", triggers_dir) -%> - -runcmd flatpak config --user --set languages "*" -runcmd flatpak remote-add --user ${flatpak_remote_name} ${flatpak_remote_url} -%if len(refs) > 0: - # We have to run a DBus session here, because Flatpak wants to talk to - # flatpak-oci-authenticator for OCI remotes - even ones that don't require - # authentication - runcmd dbus-run-session flatpak install -y --user ${flatpak_remote_name} ${flatpak_remote_refs} -%endif -runcmd mkdir -p ${root}/flatpak -runcmd ostree init --repo=${dest_repo} --mode=archive-z2 -<% -cmd_result = subprocess.run(['ostree', 'refs', '--repo={0}'.format(flatpak_repo)], stdout=subprocess.PIPE) -subprocess.run(['bash', '-c', 'echo "Help" >> /findme2.txt']) -all_refs = cmd_result.stdout.decode('utf-8').strip().split('\n') -found_refs = [entry[7:] for entry in all_refs if entry.startswith('deploy/')] -%> -%for ref in found_refs: - runcmd sh -c "ostree --repo=${dest_repo} pull-local ${flatpak_repo} $(ostree --repo=${flatpak_repo} rev-parse ${flatpak_remote_name}/${ref})" - runcmd sh -c "mkdir -p $(dirname ${dest_repo}/refs/heads/${ref})" - runcmd sh -c "ostree --repo=${flatpak_repo} rev-parse ${flatpak_remote_name}/${ref} > ${dest_repo}/refs/heads/${ref}" -%endfor -runcmd flatpak build-update-repo ${dest_repo}