From 68d93e907e46e368f32e38b946f2ca2298d712d3 Mon Sep 17 00:00:00 2001 From: fiftydinar <65243233+fiftydinar@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:55:02 +0200 Subject: [PATCH] fix(rpm-ostree): Same-named repos are overwrited instead of being downloaded separately --- modules/rpm-ostree/rpm-ostree.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/rpm-ostree/rpm-ostree.sh b/modules/rpm-ostree/rpm-ostree.sh index f200dbe..4f91210 100644 --- a/modules/rpm-ostree/rpm-ostree.sh +++ b/modules/rpm-ostree/rpm-ostree.sh @@ -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