fix: backup and restore staging repo for images that already contain it (#324)

This commit is contained in:
fiftydinar 2024-08-21 20:06:06 +02:00 committed by GitHub
commit e82d69df09
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}"