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
This commit is contained in:
qoijjj 2024-08-21 10:42:27 -07:00 committed by GitHub
parent 477ba2bbfb
commit d1aeffc2f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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