From d1aeffc2f54548f104b0d46748550250b2ed0a42 Mon Sep 17 00:00:00 2001 From: qoijjj <129108030+qoijjj@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:42:27 -0700 Subject: [PATCH] fix: backup and restore staging repo for images that already contain it recipes with aurora/bluefin as a base image will already have the staging repo present but disabled, meaning wget won't overwrite it. we don't want to change the repos in the base image in this module, so this backs up the original staging repo, runs the module steps, then restores the original staging repo --- modules/yafti/yafti.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/yafti/yafti.sh b/modules/yafti/yafti.sh index b4961e7..51d3252 100644 --- a/modules/yafti/yafti.sh +++ b/modules/yafti/yafti.sh @@ -19,6 +19,13 @@ FIRSTBOOT_LINK="${PROFILED_DIR}/ublue-firstboot.sh" # Fetch ublue COPR REPO="https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-${OS_VERSION}/ublue-os-staging-fedora-${OS_VERSION}.repo" +STAGING_REPO_PATH="/etc/yum.repos.d/ublue-os-staging-fedora-${OS_VERSION}.repo" +BACKUP_STAGING_REPO_PATH="${STAGING_REPO_PATH}.backup" + +if [ -f "$STAGING_REPO_PATH" ]; then + mv "$STAGING_REPO_PATH" "$BACKUP_STAGING_REPO_PATH" +fi + wget "${REPO//[$'\t\r\n ']}" -P "/etc/yum.repos.d/" rpm-ostree install yafti @@ -26,6 +33,10 @@ rpm-ostree install yafti # Remove ublue COPR rm /etc/yum.repos.d/ublue-os-staging-fedora-*.repo +if [ -f "$BACKUP_STAGING_REPO_PATH" ]; then + mv "$BACKUP_STAGING_REPO_PATH" "$STAGING_REPO_PATH" +fi + # If the profile.d directory doesn't exist, create it if [ ! -d "${PROFILED_DIR}" ]; then mkdir -p "${PROFILED_DIR}"