fix(rpm-ostree): Same-named repos are overwrited instead of being dow… (#312)

This commit is contained in:
fiftydinar 2024-08-05 12:12:49 +02:00 committed by GitHub
commit 2bfffac439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,8 +9,13 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then
echo "Adding repositories"
for REPO in "${REPOS[@]}"; do
REPO="${REPO//%OS_VERSION%/${OS_VERSION}}"
if [[ "${REPO}" =~ ^https?:\/\/.* ]]; then
# If it's the COPR repo, then download the repo normally
# If it's not, then download the repo with URL in it's filename, to avoid duplicate repo name issue
if [[ "${REPO}" =~ ^https?:\/\/.* ]] && [[ "${REPO}" == "https://copr.fedorainfracloud.org/coprs/"* ]]; then
curl --output-dir "/etc/yum.repos.d/" -O "${REPO//[$'\t\r\n ']}"
elif [[ "${REPO}" =~ ^https?:\/\/.* ]] && [[ "${REPO}" != "https://copr.fedorainfracloud.org/coprs/"* ]]; then
CLEAN_REPO_NAME=$(echo "${REPO}" | sed 's/^https\?:\/\///')
curl -o "/etc/yum.repos.d/${CLEAN_REPO_NAME//\//.}" "${REPO//[$'\t\r\n ']}"
elif [[ ! "${REPO}" =~ ^https?:\/\/.* ]] && [[ "${REPO}" == *".repo" ]] && [[ -f "${CONFIG_DIRECTORY}/rpm-ostree/${REPO}" ]]; then
cp "${CONFIG_DIRECTORY}/rpm-ostree/${REPO}" "/etc/yum.repos.d/${REPO##*/}"
fi