Skip to content

Commit 27f47c5

Browse files
committed
add workaround for dnf5 addrepo bug
The addrepo command has a bug that causes it to fail if the `.repo` file contains empty lines, causing it to fail; dnf config-manager addrepo --from-repofile="https://download.docker.com/linux/fedora/docker-ce.repo" Error in added repository configuration file. Cannot set repository option "#1= ": Option "#1" not found Use a temporary file and strip empty lines as a workaround until the bug is fixed. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 5cf619d commit 27f47c5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

install.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,15 @@ do_install() {
558558
set -x
559559
fi
560560
if command_exists dnf5; then
561-
$sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
562-
$sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url'"
561+
# $sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
562+
# $sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url'"
563+
564+
$sh_c "dnf -y -q --setopt=install_weak_deps=False install curl dnf-plugins-core"
565+
# FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603
566+
TMP_REPO_FILE="$(mktemp --dry-run)"
567+
$sh_c "curl -fsSL '$repo_file_url' | tr -s '\n' > '${TMP_REPO_FILE}'"
568+
$sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile='${TMP_REPO_FILE}'"
569+
$sh_c "rm -f '${TMP_REPO_FILE}'"
563570

564571
if [ "$CHANNEL" != "stable" ]; then
565572
$sh_c "dnf5 config-manager setopt 'docker-ce-*.enabled=0'"

0 commit comments

Comments
 (0)