Skip to content

Commit 7394fd5

Browse files
committed
fix: updated to support fedora 41+
1 parent 08d0762 commit 7394fd5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/install.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ install_gh_linux_apt() {
124124
install_gh_linux_dnf() {
125125
info "Installing GitHub CLI with dnf (Fedora/RHEL-compatible)."
126126
run_as_root dnf install -y 'dnf-command(config-manager)' || warn "dnf-command(config-manager) may already be installed; continuing."
127-
run_as_root dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo || error "Failed to add gh dnf repository."
127+
local gh_repo="https://cli.github.com/packages/rpm/gh-cli.repo"
128+
# DNF 5 (Fedora 41+): addrepo --from-repofile=. DNF 4: --add-repo URL
129+
# See https://dnf5.readthedocs.io/en/stable/dnf5_plugins/config-manager.8.html
130+
if dnf config-manager addrepo --help >/dev/null 2>&1; then
131+
run_as_root dnf config-manager addrepo --from-repofile="${gh_repo}" || error "Failed to add gh dnf repository."
132+
else
133+
run_as_root dnf config-manager --add-repo "${gh_repo}" || error "Failed to add gh dnf repository."
134+
fi
128135
run_as_root dnf install -y gh || error "dnf failed to install gh."
129136
}
130137

0 commit comments

Comments
 (0)