Skip to content

Commit

Permalink
add workaround for dnf5 addrepo bug
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thaJeztah committed Sep 4, 2024
1 parent 9a392f0 commit 715f683
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,15 @@ do_install() {
set -x
fi
if command_exists dnf5; then
$sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
$sh_c "dnf config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url'"
# $sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
# $sh_c "dnf config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url'"

$sh_c "dnf -y -q --setopt=install_weak_deps=False install curl dnf-plugins-core"
# FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603
TMP_REPO_FILE="$(mktemp --dry-run)"
$sh_c "curl -fsSL '$repo_file_url' | tr -s '\n' > '${TMP_REPO_FILE}'"
$sh_c "dnf config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile='${TMP_REPO_FILE}'"
$sh_c "rm -f '${TMP_REPO_FILE}'"

if [ "$CHANNEL" != "stable" ]; then
$sh_c "dnf config-manager setopt 'docker-ce-*.enabled=0'"
Expand Down

0 comments on commit 715f683

Please sign in to comment.