diff options
| author | tranch <tranch.xiao@gmail.com> | 2026-11-17 01:48:26 +0800 |
|---|---|---|
| committer | tranch <tranch.xiao@gmail.com> | 2026-11-17 01:48:26 +0800 |
| commit | 7c9d6c1e358ea3c33aeef1191e3e02f001b083bd (patch) | |
| tree | 38b3d703b46f4c497f1b28f0033068f7ee2ef877 /system_files/usr | |
| parent | 2d46b8296a7ee7243f5f6d2d01d6effa1e5b27e9 (diff) | |
| download | AeroCore-OS-7c9d6c1e358ea3c33aeef1191e3e02f001b083bd.tar.gz AeroCore-OS-7c9d6c1e358ea3c33aeef1191e3e02f001b083bd.zip | |
Update existing Flatpak remotes at boottesting-45.20261116.1
Add a systemd oneshot that applies the configured Flathub mirror after
Bazzite initializes system Flatpak remotes. Update an existing flathub
URL, or create the remote first when it is missing. Cover both paths and
invalid or empty mirror settings with behavior tests.
Diffstat (limited to 'system_files/usr')
| -rw-r--r-- | system_files/usr/lib/systemd/system/aerocore-flatpak-mirror.service | 11 | ||||
| -rwxr-xr-x | system_files/usr/libexec/aerocore-configure-flatpak-mirror | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/system_files/usr/lib/systemd/system/aerocore-flatpak-mirror.service b/system_files/usr/lib/systemd/system/aerocore-flatpak-mirror.service new file mode 100644 index 0000000..8aed8cb --- /dev/null +++ b/system_files/usr/lib/systemd/system/aerocore-flatpak-mirror.service @@ -0,0 +1,11 @@ +[Unit] +Description=Apply configured AeroCore Flatpak mirror +After=flatpak-add-fedora-repos.service bazzite-flatpak-manager.service +Wants=flatpak-add-fedora-repos.service bazzite-flatpak-manager.service + +[Service] +Type=oneshot +ExecStart=/usr/libexec/aerocore-configure-flatpak-mirror + +[Install] +WantedBy=multi-user.target diff --git a/system_files/usr/libexec/aerocore-configure-flatpak-mirror b/system_files/usr/libexec/aerocore-configure-flatpak-mirror new file mode 100755 index 0000000..42b1d84 --- /dev/null +++ b/system_files/usr/libexec/aerocore-configure-flatpak-mirror @@ -0,0 +1,21 @@ +#!/usr/bin/bash + +set -u + +config_file=/etc/environment.d/99-aerocore-mirrors.conf +[[ -r "${config_file}" ]] || exit 0 + +FLATPAK_REMOTE_URL="$(sed -n 's/^FLATPAK_REMOTE_URL=//p' "${config_file}" | tail -n 1)" +[[ -n "${FLATPAK_REMOTE_URL}" ]] || exit 0 +[[ "${FLATPAK_REMOTE_URL}" =~ ^https?://[^[:space:]]+$ ]] || { + echo "Ignoring invalid FLATPAK_REMOTE_URL: ${FLATPAK_REMOTE_URL}" >&2 + exit 0 +} + +mirror_url="${FLATPAK_REMOTE_URL%/}/" +if flatpak remotes --system --columns=name | grep -Fxq flathub; then + flatpak remote-modify --system flathub --url="${mirror_url}" +else + flatpak remote-add --system --if-not-exists flathub /etc/flatpak/remotes.d/flathub.flatpakrepo + flatpak remote-modify --system flathub --url="${mirror_url}" +fi |
