Peppermint-Classic-Build-Files/PeppermintOS-Classic-amd64/config/includes.chroot/usr/share/browser-manager/opera/install

80 lines
2.9 KiB
Plaintext
Raw Normal View History

#!/bin/bash
################
#Check for root#
################
if [ ! $USERNAME = "root" ]; then
pkexec /usr/share/browser-manager/opera/install
exit 0
fi
##########
#Question#
##########
zenity --question --title="Continue?" --text "The use of Opera is governed by the Terms found on https://www.opera.com/terms
and the Privacy Statement found on https://www.opera.com/privacy, are you sure
you want to install Opera?" --no-wrap
if [ ! $? -eq 0 ]; then
exit
fi
###############################
#Check if program is installed#
###############################
dpkg --get-selections | grep -P -q "opera-stable\t*install"
if [ $? -eq 0 ]; then
if [ -e "/usr/bin/opera" ]; then
zenity --info --title="Information" --text="Opera is already installed!"
exit 0
fi
fi
###################################
#Check if program is not installed#
###################################
dpkg --get-selections | grep -P -q "opera-stable\t*install"
if [ ! $? -eq 0 ]; then
if [ ! -e "/usr/bin/opera" ]; then
#################
#Install program#
#################
#Add PPA if it doesn't exist
if [ ! -f /etc/apt/sources.list.d/opera-stable.list ]; then
wget -qO- https://deb.opera.com/archive.key | apt-key add - | zenity --progress --no-cancel --title="Installing..." --text="Obtaining Opera PPA Key..." --pulsate --auto-close
echo -e "# This file makes sure that Opera Browser is kept up-to-date\n# as part of regular system upgrades\n\ndeb https://deb.opera.com/opera-stable/ stable non-free #Opera Browser (final releases)" > /etc/apt/sources.list.d/opera-stable.list && apt-get update && apt-get -y install vivaldi-stable | zenity --progress --no-cancel --no-cancel --title="Installing..." --text="Downloading and Installing..." --pulsate --auto-close
fi
sleep 1
apt-get update | zenity --progress --no-cancel --title="Installing..." --text="Updating package archive..." --pulsate --auto-close && echo "opera-stable opera-stable/add-deb-source boolean true" | debconf-set-selections && apt-get install -y -q opera-stable | zenity --progress --no-cancel --title="Installing..." --text="Downloading and Installing..." --pulsate --auto-close
fi
######################
#Double Check Package#
######################
dpkg --get-selections | grep -P -q "opera-stable\t*install"
if [ $? -eq 0 ]; then
if [ -e "/usr/bin/opera" ]; then
zenity --info --title="Installation Complete" --text="Opera 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