#!/bin/bash ################ #Check for root# ################ if [ ! $USERNAME = "root" ]; then pkexec /usr/share/browser-manager/brave/install exit 0 fi ########## #Question# ########## zenity --question --title="Continue?" --text "The use of Brave is governed by the Terms of Use found at https://brave.com/terms-of-use/, are you sure you want to install Brave?" --no-wrap if [ ! $? -eq 0 ]; then exit fi ############################### #Remove Old Brave# ############################### dpkg --get-selections | grep -P -q "brave\t*install" if [ $? -eq 0 ]; then if [ -e "/usr/bin/brave" ]; then apt-get -y purge brave | zenity --progress --no-cancel --title="Installing..." --text="Removing the Old Brave..." --pulsate --auto-close rm -f /etc/apt/sources.list.d/brave.list fi fi ############################### #Check if program is installed# ############################### dpkg --get-selections | grep -P -q "brave-browser\t*install" if [ $? -eq 0 ]; then if [ -e "/usr/bin/brave-browser" ]; then zenity --info --title="Information" --text="Brave is already installed!" exit 0 fi fi ################################### #Check if program is not installed# ################################### dpkg --get-selections | grep -P -q "brave\t*install" if [ ! $? -eq 0 ]; then if [ ! -e "/usr/bin/brave-browser" ]; then ################# #Install program# ################# #Add PPA if it doesn't exist if [ ! -f /etc/apt/sources.list.d/brave.list ]; then apt-get update | zenity --progress --no-cancel --no-cancel --title="Installing..." --text="Updating package archive..." --pulsate --auto-close && wget -q -O - https://brave-browser-apt-release.s3.brave.com/brave-core.asc | apt-key add - | zenity --progress --no-cancel --title="Installing..." --text="Obtaining Brave GPG Key..." --pulsate --auto-close echo "deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | tee /etc/apt/sources.list.d/brave.list fi sleep 1 apt-get update | zenity --progress --no-cancel --title="Installing..." --text="Updating package archive..." --pulsate --auto-close && apt-get -y install brave-keyring brave-browser | zenity --progress --no-cancel --title="Installing..." --text="Downloading and Installing..." --pulsate --auto-close fi ###################### #Double Check Package# ###################### dpkg --get-selections | grep -P -q "brave-browser\t*install" if [ $? -eq 0 ]; then if [ -e "/usr/bin/brave-browser" ]; then zenity --info --title="Installation Complete" --text="Brave installed successfully!" exit 0 fi ####### #Error# ####### zenity --error --text="An error occured." --title="Error" exit 0 fi fi ####### #Error# ####### zenity --error --text="An error occured." --title="Error" exit 0