Skip to content

Commit

Permalink
Merge pull request #1059 from thaJeztah/rpm_dnf5_compat
Browse files Browse the repository at this point in the history
[master] install_rpm_containerd: add support for dnf5
  • Loading branch information
thaJeztah authored Sep 4, 2024
2 parents d757a76 + f43b3cf commit ec2c0b6
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions install-containerd-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,29 @@ function install_rpm_containerd() {
# so this logic works for both cases.
# (See also same logic in install_debian_containerd)

if dnf --version; then
if command -v dnf5; then
dnf --version

# FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603
TMP_REPO_FILE="$(mktemp --dry-run)"
curl -fsSL "${REPO_URL}" | tr -s '\n' > "${TMP_REPO_FILE}"
dnf config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile="${TMP_REPO_FILE}"
rm -f "${TMP_REPO_FILE}"
# dnf config-manager addrepo --save-filename=docker-ce.repo --from-repofile="${REPO_URL}"
dnf config-manager setopt 'docker-ce-*.enabled=0'
dnf config-manager setopt 'docker-ce-test.enabled=1'
dnf makecache
elif command -v dnf; then
dnf --version

dnf config-manager --add-repo "${REPO_URL}"
dnf config-manager --set-disabled docker-ce-*
dnf config-manager --set-enabled docker-ce-test
dnf config-manager --set-disabled 'docker-ce-*'
dnf config-manager --set-enabled 'docker-ce-test'
dnf makecache
else
yum-config-manager --add-repo "${REPO_URL}"
yum-config-manager --disable docker-ce-*
yum-config-manager --enable docker-ce-test
yum-config-manager --disable 'docker-ce-*'
yum-config-manager --enable 'docker-ce-test'
yum makecache
fi
}
Expand Down

0 comments on commit ec2c0b6

Please sign in to comment.