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

80 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
################
#Check for root#
################
if [ ! $USERNAME = "root" ]; then
pkexec /usr/share/browser-manager/chrome/install
exit 0
fi
lynx --dump https://www.google.com/chrome/browser/privacy/eula_text.html | awk 'NR>1' > /tmp/chrome-tos.txt
echo "The use of Google Chrome is governed by these terms and conditions, are you sure you want to install Chrome?
$(cat /tmp/chrome-tos.txt)" > /tmp/chrome-tos.txt
if [ $? -eq 0 ]; then
zenity --text-info --filename=/tmp/chrome-tos.txt --title="Continue?" --text --checkbox="I read and accept the terms. I would like to install Google Chrome." --cancel-label="No" --ok-label="Yes" --icon-name="dialog-question"
else
##########
#Question#
##########
zenity --question --title="Continue?" --text "Are you sure you want to install Chrome?"
fi
if [ ! $? -eq 0 ]; then
rm -f /tmp/chrome-tos.txt
exit
fi
rm -f /tmp/chrome-tos.txt
###############################
#Check if program is installed#
###############################
dpkg --get-selections | grep -P -q "google-chrome-stable\t*install"
if [ $? -eq 0 ]; then
if [ -e "/usr/bin/google-chrome" ]; then
zenity --info --title="Information" --text="Google Chrome is already installed!"
exit 0
fi
fi
###################################
#Check if program is not installed#
###################################
dpkg --get-selections | grep -P -q "google-chrome-stable\t*install"
if [ ! $? -eq 0 ]; then
if [ ! -e "/usr/bin/google-chrome" ]; then
#################
#Install program#
#################
apt-get update | zenity --progress --no-cancel --no-cancel --title="Installing..." --text="Updating package archive..." --pulsate --auto-close && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | zenity --progress --no-cancel --title="Installing..." --text="Obtaining Chrome GPG Key..." --pulsate --auto-close
echo -e "### THIS FILE IS AUTOMATICALLY CONFIGURED ###\n# You may comment out this entry, but any other modifications may be lost.\ndeb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && apt-get update && apt-get -y install google-chrome-stable | zenity --progress --no-cancel --no-cancel --title="Installing..." --text="Downloading and Installing..." --pulsate --auto-close
fi
######################
#Double Check Package#
######################
dpkg --get-selections | grep -P -q "google-chrome-stable\t*install"
if [ $? -eq 0 ]; then
if [ -e "/usr/bin/google-chrome" ]; then
zenity --info --title="Installation Complete" --text="Google Chrome 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