Skip to content

Commit

Permalink
fix: Get raw COPR repos array elements without JSON brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Dec 22, 2024
1 parent 2f392e7 commit 6d1047f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/dnf/dnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d1047f

Please sign in to comment.