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

use upstream

This commit is contained in:
Jason N. 2024-03-07 18:51:46 -05:00
parent ddf7551727
commit d8f9645e6f
4 changed files with 8 additions and 51 deletions

View file

@ -134,6 +134,8 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Ensure qemu is installed
run: |

4
.gitmodules vendored Normal file
View file

@ -0,0 +1,4 @@
[submodule "external/fedora-lorax-templates"]
path = external/fedora-lorax-templates
url = https://pagure.io/fedora-lorax-templates.git
branch = f39

View file

@ -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/

View file

@ -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}