From f400eee4b18d8f7d57420304fc3307c169483849 Mon Sep 17 00:00:00 2001 From: Angaddeep Singh <159604852+Angxddeep@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:42:16 +0530 Subject: [PATCH] fix(fedora): Recent syntax changes with DNF5 (#907) * Dnf5 fixes * again fix :) * final fix * added version check * Apply suggestions from code review Co-authored-by: Jeevitha Kannan K S * Update core/tabs/applications-setup/Developer-tools/sublime-setup.sh Co-authored-by: Jeevitha Kannan K S --------- Co-authored-by: Jeevitha Kannan K S --- .../Developer-tools/sublime-setup.sh | 7 ++++++- core/tabs/applications-setup/browsers/brave.sh | 7 ++++++- core/tabs/applications-setup/browsers/vivaldi.sh | 7 ++++++- core/tabs/applications-setup/docker-setup.sh | 14 ++++++++++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/core/tabs/applications-setup/Developer-tools/sublime-setup.sh b/core/tabs/applications-setup/Developer-tools/sublime-setup.sh index 16c03497..18843752 100644 --- a/core/tabs/applications-setup/Developer-tools/sublime-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/sublime-setup.sh @@ -23,7 +23,12 @@ installSublime() { ;; dnf) "$ESCALATION_TOOL" rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y sublime-text ;; *) diff --git a/core/tabs/applications-setup/browsers/brave.sh b/core/tabs/applications-setup/browsers/brave.sh index 6618f0fe..995775e3 100644 --- a/core/tabs/applications-setup/browsers/brave.sh +++ b/core/tabs/applications-setup/browsers/brave.sh @@ -25,7 +25,12 @@ installBrave() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + fi "$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc "$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser ;; diff --git a/core/tabs/applications-setup/browsers/vivaldi.sh b/core/tabs/applications-setup/browsers/vivaldi.sh index 311816d0..28535a52 100644 --- a/core/tabs/applications-setup/browsers/vivaldi.sh +++ b/core/tabs/applications-setup/browsers/vivaldi.sh @@ -15,7 +15,12 @@ installVivaldi() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://repo.vivaldi.com/stable/vivaldi-fedora.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable ;; zypper) diff --git a/core/tabs/applications-setup/docker-setup.sh b/core/tabs/applications-setup/docker-setup.sh index c4fc53ff..b693656b 100755 --- a/core/tabs/applications-setup/docker-setup.sh +++ b/core/tabs/applications-setup/docker-setup.sh @@ -28,7 +28,12 @@ install_docker() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo + fi "$ESCALATION_TOOL" "$PACKAGER" -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin "$ESCALATION_TOOL" systemctl enable --now docker ;; @@ -58,7 +63,12 @@ install_docker_compose() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin ;; zypper)