From 163c36b2a122fbdbf769abd08c44736735906dce Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 9 Feb 2024 10:18:18 -0600 Subject: [PATCH] chore(ci): conditional pin to repo variable RPMFUSION_MIRROR (#195) Prompted by ocf.berkeley being down for a system rebuildand the proven usefulness of using a single mirror, this approach allows local builds with no build-args to work with a default RPMFusion mirror metalink setup, but in case of the build arg (in our CI, a repo variable) RPMFUSION_MIRROR being set, that URL will be substituted as the forced single mirror repo. --- .github/workflows/build.yml | 1 + Containerfile | 1 + install.sh | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 279d5865..694728cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -170,6 +170,7 @@ jobs: IMAGE_NAME=${{ matrix.image_name }} FEDORA_MAJOR_VERSION=${{ matrix.major_version }} NVIDIA_MAJOR_VERSION=${{ matrix.driver_version }} + RPMFUSION_MIRROR=${{ vars.RPMFUSION_MIRROR }} labels: ${{ steps.meta.outputs.labels }} oci: false diff --git a/Containerfile b/Containerfile index 262abe1e..bf5df244 100644 --- a/Containerfile +++ b/Containerfile @@ -9,6 +9,7 @@ ARG IMAGE_VENDOR="ublue-os" ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-nvidia}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-545}" +ARG RPMFUSION_MIRROR="" COPY image-info.sh /tmp/image-info.sh COPY install.sh /tmp/install.sh diff --git a/install.sh b/install.sh index 9e21d978..383ac180 100755 --- a/install.sh +++ b/install.sh @@ -8,12 +8,15 @@ else sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo fi -# force use of single rpmfusion mirror -sed -i.bak 's%^metalink=%#metalink=%' /etc/yum.repos.d/rpmfusion-*.repo -sed -i 's%^#baseurl=http://download1.rpmfusion.org%baseurl=http://mirrors.ocf.berkeley.edu/rpmfusion%' /etc/yum.repos.d/rpmfusion-*.repo -# after F40 launches, bump to 41 -if [[ "${FEDORA_MAJOR_VERSION}" -ge 40 ]]; then - sed -i 's%free/fedora/releases%free/fedora/development%' /etc/yum.repos.d/rpmfusion-*.repo +if [ -n "${RPMFUSION_MIRROR}" ]; then + # force use of single rpmfusion mirror + echo "Using single rpmfusion mirror: ${RPMFUSION_MIRROR}" + sed -i.bak "s%^metalink=%#metalink=%" /etc/yum.repos.d/rpmfusion-*.repo + sed -i "s%^#baseurl=http://download1.rpmfusion.org%baseurl=${RPMFUSION_MIRROR}%" /etc/yum.repos.d/rpmfusion-*.repo + # after F40 launches, bump to 41 + if [[ "${FEDORA_MAJOR_VERSION}" -ge 40 ]]; then + sed -i "s%free/fedora/releases%free/fedora/development%" /etc/yum.repos.d/rpmfusion-*.repo + fi fi rpm-ostree install \ @@ -35,5 +38,8 @@ rpm-ostree install \ nvidia-container-toolkit nvidia-vaapi-driver supergfxctl ${VARIANT_PKGS} \ /tmp/akmods-rpms/kmods/kmod-${NVIDIA_PACKAGE_NAME}-${KERNEL_VERSION}-${NVIDIA_AKMOD_VERSION}.fc${RELEASE}.rpm -# reset forced use of single rpmfusion mirror -rename -v .repo.bak .repo /etc/yum.repos.d/rpmfusion-*repo.bak +if [ -n "${RPMFUSION_MIRROR}" ]; then + # reset forced use of single rpmfusion mirror + echo "Revert from single rpmfusion mirror: ${RPMFUSION_MIRROR}" + rename -v .repo.bak .repo /etc/yum.repos.d/rpmfusion-*repo.bak +fi