linutil/core/tabs/applications-setup/browsers/brave.sh
Angaddeep Singh f400eee4b1
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 <ksjeevithakannan123@gmail.com>

* Update core/tabs/applications-setup/Developer-tools/sublime-setup.sh

Co-authored-by: Jeevitha Kannan K S <ksjeevithakannan123@gmail.com>

---------

Co-authored-by: Jeevitha Kannan K S <ksjeevithakannan123@gmail.com>
2024-11-11 10:12:16 -06:00

54 lines
2.6 KiB
Bash

#!/bin/sh -e
. ../../common-script.sh
installBrave() {
if ! command_exists com.brave.Browser && ! command_exists brave; then
printf "%b\n" "${YELLOW}Installing Brave...${RC}"
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl
"$ESCALATION_TOOL" curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/brave-browser-release.list
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl
"$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
"$ESCALATION_TOOL" "$PACKAGER" addrepo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
"$ESCALATION_TOOL" "$PACKAGER" refresh
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install brave-browser
;;
pacman)
"$AUR_HELPER" -S --needed --noconfirm brave-bin
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core
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
;;
apk)
checkFlatpak
flatpak install -y flathub com.brave.Browser
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;;
esac
else
printf "%b\n" "${GREEN}Brave Browser is already installed.${RC}"
fi
}
checkEnv
checkEscalationTool
checkAURHelper
installBrave