From 6d1047f7ca37a6cb0f238510b384831f0dbc8ae6 Mon Sep 17 00:00:00 2001 From: fiftydinar <65243233+fiftydinar@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:57:58 +0100 Subject: [PATCH] fix: Get raw COPR repos array elements without JSON brackets --- modules/dnf/dnf.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/dnf/dnf.sh b/modules/dnf/dnf.sh index 71566bf6..49edf90e 100644 --- a/modules/dnf/dnf.sh +++ b/modules/dnf/dnf.sh @@ -24,8 +24,13 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then for i in "${!REPOS[@]}"; do repo="${REPOS[$i]}" repo="${repo//%OS_VERSION%/${OS_VERSION}}" - REPOS[$i]="${repo//[$'\t\r\n ']}" - done + # Extract copr repo array element properly here without JSON brackets (jq doesn't extract elements with spaces properly like yq does) + if [[ "${repo}" == "{\"copr\":\""*"\"}" ]]; then + REPOS[$i]="$(echo "copr: $(echo "${repo}" | jq -r '.copr')")" + else + # Trim all whitespaces/newlines for other repos + REPOS[$i]="${repo//[$'\t\r\n ']}" + fi done # dnf config-manager & dnf copr don't support adding multiple repositories at once, hence why for/done loop is used for repo in "${REPOS[@]}"; do if [[ "${repo}" =~ ^https?:\/\/.* ]]; then