diff --git a/AUTHORS b/AUTHORS old mode 100644 new mode 100755 diff --git a/data/aliases.list b/data/aliases.list old mode 100644 new mode 100755 diff --git a/data/codecs.list b/data/codecs.list old mode 100644 new mode 100755 diff --git a/data/dependencies.list b/data/dependencies.list old mode 100644 new mode 100755 diff --git a/data/development.list b/data/favs-dev.list old mode 100644 new mode 100755 similarity index 100% rename from data/development.list rename to data/favs-dev.list diff --git a/data/fonts.list b/data/favs-fonts.list old mode 100644 new mode 100755 similarity index 100% rename from data/fonts.list rename to data/favs-fonts.list diff --git a/data/utilities.list b/data/favs-utils.list old mode 100644 new mode 100755 similarity index 100% rename from data/utilities.list rename to data/favs-utils.list diff --git a/data/favs.list b/data/favs.list old mode 100644 new mode 100755 index 111930a7..eb978900 --- a/data/favs.list +++ b/data/favs.list @@ -1,12 +1,12 @@ -cockpit dconf-tools -gimp gnome-disk-utility +gnome-session gnome-software +gnome-software-plugin-flatpak +gnome-software-plugin-snap gnome-sushi gnome-tweak-tool gpick nautilus -plank sparkleshare -transmission +transmission \ No newline at end of file diff --git a/data/gnome-apps.list b/data/gnome-apps.list old mode 100644 new mode 100755 index 24e4b65d..4dd1f1d6 --- a/data/gnome-apps.list +++ b/data/gnome-apps.list @@ -1,5 +1,6 @@ bijiben epiphany-browser +fonts-cantarell gedit gnome-builder gnome-calculator @@ -15,4 +16,5 @@ gnome-screenshot gnome-software gnome-system-monitor gnome-terminal +gnome-todo gnome-weather \ No newline at end of file diff --git a/data/gnome-desktop.list b/data/gnome-desktop.list deleted file mode 100644 index ab0ed76c..00000000 --- a/data/gnome-desktop.list +++ /dev/null @@ -1,8 +0,0 @@ -fonts-cantarell -gnome-shell -gnome-control-center -gnome-shell-extensions -gnome-shell-extension-top-icons-plus -gnome-session -gnome-terminal -nautilus \ No newline at end of file diff --git a/data/gnome-shell-extenstions.list b/data/gnome-shell-extenstions.list new file mode 100644 index 00000000..c471b1be --- /dev/null +++ b/data/gnome-shell-extenstions.list @@ -0,0 +1,5 @@ +gnome-shell-extensions +gnome-shell-extension-alternate-tab +gnome-shell-extension-dash-to-dock +gnome-shell-extension-topicons-plus +gnome-shell-extension-user-theme \ No newline at end of file diff --git a/data/gsettings.list b/data/gsettings.list old mode 100644 new mode 100755 diff --git a/data/node.list b/data/node.list old mode 100644 new mode 100755 diff --git a/data/purge.list b/data/purge.list old mode 100644 new mode 100755 index 0d12d8ce..190e63ad --- a/data/purge.list +++ b/data/purge.list @@ -1,37 +1,17 @@ activity-log-manager aisleriot -checkbox-converged deja-dup gnome-mahjongg gnome-mines gnome-sudoku hplip -landscape-client-ui-install -overlay-scrollbar -overlay-scrollbar-gtk2 -overlay-scrollbar-gtk3 +libreoffice-* remmina rhythmbox shotwell -shotwell-common thunderbird -ubuntu-system-settings ubuntu-web-launchers -unity-scope-calculator -unity-scope-chromiumbookmarks -unity-scope-colourlovers -unity-scope-devhelp -unity-scope-firefoxbookmarks -unity-scope-gdrive -unity-scope-manpages -unity-scope-openclipart -unity-scope-texdoc -unity-scope-tomboy -unity-scope-video-remote -unity-scope-virtualbox -unity-scope-yelp -unity-scope-zotero -unity8* +unity-* usb-creator-gtk webbrowser-app xdiagnose \ No newline at end of file diff --git a/functions/add_repositories b/functions/add_repositories new file mode 100644 index 00000000..e58664a4 --- /dev/null +++ b/functions/add_repositories @@ -0,0 +1,44 @@ + +# Add Flatpak Repo +function add_flatpak_repo() { + echo_message header "Starting 'add_flatpak_repo' function" + # Check if already added + flatpak remotes | grep $1 &> /dev/null + # If repo is added + if [ $? = 0 ]; then + echo_message info "Repository already added." + whiptail --msgbox "The $1 repository is already added." 8 56 + else + # Add repository + echo_message info "Adding flatpak repository..." + flatpak remote-add --if-not-exists $1 $2 + echo_message success "Repository added." + whiptail --title "Finished" --msgbox "The '$1' repository has been added." 8 56 + fi +} + +# Add Launchpad PPA +function add_launchpad_ppa() { + echo_message header "Starting 'add_launchpad_ppa' function" + # Check if PPA already added + if ! grep -q "^deb .*${2}" /etc/apt/sources.list /etc/apt/sources.list.d/*; then + # draw window + if (whiptail \ + --title "Add PPA Repository" \ + --yesno "The ${1} PPA repository (${2}) is not present on your system. \n\nWould you like to add it to continue? " 10 64) then + # Add repository + echo_message info "Adding ${1} PPA repository..." + elevate_privilege "add-apt-repository -y ppa:${2}" + # Update repository information + elevate_privilege "apt update -y" + # Done + echo_message success "Repository added." + else + # Cancelled + echo_message info "Addition of ${1} repository cancelled." + $3 + fi + else + echo_message info "${1} repository already added." + fi +} \ No newline at end of file diff --git a/functions/apps/atom b/functions/apps/atom deleted file mode 100644 index 8696b955..00000000 --- a/functions/apps/atom +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Atom -function atom { - # Variables - NAME="Atom" - PACKAGE=atom - VERSION=1.21.0 - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - whiptail --title "Error." --msgbox "No 32-bit version of this app available to download." 8 64 - ;; - x86_64) - curl -O https://atom-installer.github.com/v${VERSION}/${PACKAGE}-amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - # Admin privileges - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finish - rm $PACKAGE*.deb - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/chrome b/functions/apps/chrome old mode 100644 new mode 100755 index 74526947..403f9e70 --- a/functions/apps/chrome +++ b/functions/apps/chrome @@ -1,51 +1,17 @@ #!/bin/bash # Install Chrome -function install_chrome { +function download_chrome { # Variables - PACKAGE=google-chrome-$@ NAME="Google Chrome ($@)" - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://dl.google.com/linux/direct/${PACKAGE}_current_i386.deb - ;; - x86_64) - curl -O https://dl.google.com/linux/direct/${PACKAGE}_current_amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finish - rm $PACKAGE*.deb - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - status=1 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi + PACKAGE=google-chrome-$@_current + REMOTE="https://dl.google.com/linux/direct" + install_remote_package $NAME $PACKAGE $REMOTE install_thirdparty + status=1 } # Google Chrome -function chrome { +function install_chrome { eval `resize` EXITSTATUS=$? if [ $EXITSTATUS = 0 ]; then @@ -64,20 +30,20 @@ if [ $EXITSTATUS = 0 ]; then # Change to lower case and remove spaces. case "${VERSION}" in stable) - install_chrome stable; + download_chrome stable; ;; beta) - install_chrome beta; + download_chrome beta; ;; unstable) - install_chrome unstable; + download_chrome unstable; ;; *) status=1 - thirdparty + install_thirdparty ;; esac done else - thirdparty + install_thirdparty fi } \ No newline at end of file diff --git a/functions/apps/dropbox b/functions/apps/dropbox old mode 100644 new mode 100755 index b6a14276..27338720 --- a/functions/apps/dropbox +++ b/functions/apps/dropbox @@ -1,48 +1,10 @@ #!/bin/bash # Dropbox -function dropbox { +function install_dropbox { # Variables NAME="Dropbox" - PACKAGE=dropbox - VERSION=2.10.0 - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://linux.dropbox.com/packages/ubuntu/dropbox_${VERSION}_i386.deb - ;; - x86_64) - curl -O https://linux.dropbox.com/packages/ubuntu/dropbox_${VERSION}_amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - # Admin privileges - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finish - rm $PACKAGE*.deb - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi + PACKAGE="dropbox_2.10.0" + REMOTE="https://linux.dropbox.com/packages/ubuntu" + install_remote_package $NAME $PACKAGE $REMOTE install_thirdparty } \ No newline at end of file diff --git a/functions/apps/firefox b/functions/apps/firefox deleted file mode 100644 index ee2e414d..00000000 --- a/functions/apps/firefox +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Firefox -function firefox { - # Variables - NAME="Firefox (Beta)" - PACKAGE=firefox - PPANAME=ppa:mozillateam/firefox-next - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success 'Done' - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/flatpak b/functions/apps/flatpak deleted file mode 100644 index d2e6d4c5..00000000 --- a/functions/apps/flatpak +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Flatpak -function flatpak { - # Variables - NAME="Flatpak" - PACKAGE=flatpak - PPANAME=ppa:alexlarsson/flatpak - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success 'Done' - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/fontforge b/functions/apps/fontforge old mode 100644 new mode 100755 index 1ad40366..21a5e505 --- a/functions/apps/fontforge +++ b/functions/apps/fontforge @@ -1,38 +1,25 @@ #!/bin/bash -# FontForge -function fontforge { - # Variables +# Install FontForge from PPA +function install_fontforge { NAME="FontForge" - PACKAGE=fontforge - PPANAME=ppa:fontforge/fontforge - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success 'Done' - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" + PACKAGE="fontforge" + # Do not include the "ppa:" bit, it will break other functions + PPA="fontforge/fontforge" + # Add PPA repository + add_launchpad_ppa "$NAME" "$PPA" install_thirdparty + # check exit status + if [ $? = 0 ]; then + # Install package + install_package "$NAME" "$PACKAGE" install_thirdparty # Done echo_message success "Installation of '$PACKAGE' complete." whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty + install_thirdparty else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty + # Cancelled + echo_message info "Installation of $NAME cancelled." + # return + install_thirdparty fi } \ No newline at end of file diff --git a/functions/apps/inkscape b/functions/apps/inkscape deleted file mode 100644 index 5c4386ff..00000000 --- a/functions/apps/inkscape +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Inkscape -function inkscape { - # Variables - NAME="Inkscape" - PACKAGE=inkscape - PPANAME=ppa:inkscape.dev/stable - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success 'Done' - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/mattermost b/functions/apps/mattermost deleted file mode 100644 index ab6c06ed..00000000 --- a/functions/apps/mattermost +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Download function for ease of reuse -function install_mattermost { - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://releases.mattermost.com/desktop/${VERSION}/${PACKAGE}-${VERSION}-linux-i386.deb - ;; - x86_64) - curl -O https://releases.mattermost.com/desktop/${VERSION}/${PACKAGE}-${VERSION}-linux-amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finish - rm ${PACKAGE}*.deb - echo_message success "Installation of '$PACKAGE' complete." -} - - -# Mattermost -function mattermost { - # Variables - NAME="Mattermost" - PACKAGE=mattermost-desktop - VERSION=3.7.0 - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - install_mattermost - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - VERSCHECK=$(dpkg-query -W --showformat='${Version}\n' $PACKAGE) - if [ "$VERSION" == "$VERSCHECK" ]; then - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - else - # Update - echo_message info $NAME '$NAME is already installed, but out-of-date.' - echo_message info 'Updating '$NAME'...' - # Install - install_mattermost - whiptail --title "Finished" --msgbox "Updating of $NAME complete." 8 64 - thirdparty - fi - fi -} diff --git a/functions/apps/minecraft b/functions/apps/minecraft deleted file mode 100644 index 4db931c0..00000000 --- a/functions/apps/minecraft +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Minecraft -function minecraft { - # Variables - NAME="Minecraft Launcher" - PACKAGE=minecraft-installer - PPANAME=ppa:minecraft-installer-peeps/minecraft-installer - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/oracle-java b/functions/apps/oracle-java index 7a7a69f1..0766bb9e 100644 --- a/functions/apps/oracle-java +++ b/functions/apps/oracle-java @@ -1,38 +1,25 @@ #!/bin/bash -# Java -function oracle-java { - # Variables +# Install Oracle Java from PPA +function install_oracle_java { NAME="Oracle Java 9" - PACKAGE=oracle-java9-installer - PPANAME=ppa:webupd8team/java - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" + PACKAGE="oracle-java9-installer" + # Do not include the "ppa:" bit, it will break other functions + PPA="webupd8team/java" + # Add PPA repository + add_launchpad_ppa "$NAME" "$PPA" install_thirdparty + # check exit status + if [ $? = 0 ]; then + # Install package + install_package "$NAME" "$PACKAGE" install_thirdparty # Done echo_message success "Installation of '$PACKAGE' complete." whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty + install_thirdparty else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty + # Cancelled + echo_message info "Installation of $NAME cancelled." + # return + install_thirdparty fi } \ No newline at end of file diff --git a/functions/apps/peek b/functions/apps/peek deleted file mode 100644 index 730eebcb..00000000 --- a/functions/apps/peek +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Peek -function peek { - # Variables - NAME="Peek" - PACKAGE=peek - PPANAME=ppa:peek-developers/daily - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/pia b/functions/apps/pia old mode 100644 new mode 100755 index 38b84912..e25172e0 --- a/functions/apps/pia +++ b/functions/apps/pia @@ -1,11 +1,11 @@ #!/bin/bash # Private Internet Access -function pia { +function install_pia { # Variables NAME="Private Internet Access" - TARBALL=pia-v73-installer-linux - VERSION=v73 + TARBALL=pia-v75-installer-linux + VERSION=v75 CHECKSUM=4948b4a7f8d6454ac3bada85e37883a3b775a45f7da8e83a2c17042053c62b4b # Start echo_message header 'Begin '$NAME' installation' diff --git a/functions/apps/plex b/functions/apps/plex deleted file mode 100644 index 4563d505..00000000 --- a/functions/apps/plex +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# Plex -function plex { - # Variables - NAME="Plex" - PACKAGE=plexmediaserver - LIST=plexmediaserver.list - KEY='https://downloads.plex.tv/plex-keys/PlexSign.key' - REPO='deb https://downloads.plex.tv/repo/deb ./public main' - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Check if repository already exists - echo_message info 'Checking if '$NAME' repository is already added...' - if [ ! -f /etc/apt/sources.list.d/${LIST} ]; then - # Add the repository signing key to be able to verify downloaded packages - echo_message info 'Adding '$NAME' signing key to keyring...' - # Download Key - curl -sL $KEY | elevate_privilege "apt-key add -" - # Done - echo_message success "Installation of '$PACKAGE' complete." - # Add the repository - echo_message info 'Adding '$NAME' repository to software sources...' - # Write repository to apt sources list file - echo $REPO | elevate_privilege "tee /etc/apt/sources.list.d/${LIST}" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - else - echo_message info $NAME 'repository already in software sources.' - fi - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/riot b/functions/apps/riot deleted file mode 100644 index 6e7f06e9..00000000 --- a/functions/apps/riot +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# Riot -function riot { - # Variables - NAME="Riot" - PACKAGE=riot-web - LIST=riot-im.list - KEY='https://riot.im/packages/debian/repo-key.asc' - # KEY='E019645248E8F4A1' - REPO="deb https://riot.im/packages/debian/ $(lsb_release -cs) main" - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Check if repository already exists - echo_message info 'Checking if '$NAME' repository is already added...' - if [ ! -f /etc/apt/sources.list.d/${LIST} ]; then - # Add the repository signing key to be able to verify downloaded packages - echo_message info 'Adding '$NAME' signing key to keyring...' - # Download key - curl -sL $KEY | elevate_privilege "apt-key add -" - # Done - echo_message success "Installation of '$PACKAGE' complete." - # Add the repository - echo_message info 'Adding '$NAME' repository to software sources...' - # Write repository to apt sources list file - echo $REPO | elevate_privilege "tee /etc/apt/sources.list.d/${LIST}" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - else - echo_message info $NAME 'repository already in software sources.' - fi - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/rvm b/functions/apps/rvm old mode 100644 new mode 100755 index 7167fb59..582db57a --- a/functions/apps/rvm +++ b/functions/apps/rvm @@ -1,39 +1,39 @@ #!/bin/bash # RVM -function rvm { +function install_rvm { # Variables NAME="Ruby Version Manager" KEYID='409B6B1796C275462A1703113804BB82D39DC0E3' KEYSERVER='hkp://keys.gnupg.net' # Check if already installed - echo_message info 'Checking if '$NAME' already installed...' + echo_message info "Checking if $NAME already installed..." if [ ! -f ~/.rvm/installed.at ]; then - echo_message info $NAME 'is not installed.' + echo_message info "$NAME is not installed." echo 'Proceeding' # Check if key already exists in keyring KEYCHECK=$(gpg --list-keys | grep -w ${KEYID}) if [ "" == "$KEYCHECK" ]; then # Add the repository signing key to be able to verify downloaded packages - echo_message info 'Adding '$NAME' signing key to keyring...' + echo_message info "Adding $NAME signing key to keyring..." # Import Key gpg --keyserver $KEYSERVER --recv-keys $KEYID # Done echo_message success "Installation of '$PACKAGE' complete." else - echo_message info $NAME 'signing key already in keyring.' + echo_message info "$NAME signing key already in keyring." fi # Install - echo_message info 'Installing '$NAME'...' + echo_message info "Installing $NAME..." \curl -sSL https://get.rvm.io | bash -s stable --ruby # \curl -sSL https://get.rvm.io | bash # Uncomment for development version # Done - echo_message success "Installation of '$PACKAGE' complete." + echo_message success "Installation of $NAME complete." whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 thirdparty else # Already installed - echo_message info $NAME 'already installed.' + echo_message info "$NAME already installed." whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 thirdparty fi diff --git a/functions/apps/slack b/functions/apps/slack deleted file mode 100644 index 00be72e4..00000000 --- a/functions/apps/slack +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Slack -function slack { - # Variables - NAME="Slack" - PACKAGE=slack-desktop - VERSION=2.8.2 - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://downloads.slack-edge.com/linux_releases/slack-desktop-${VERSION}-i386.deb - ;; - x86_64) - curl -O https://downloads.slack-edge.com/linux_releases/slack-desktop-${VERSION}-amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finish - rm ${PACKAGE}-*.deb - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/spotify b/functions/apps/spotify deleted file mode 100644 index 1cdf5f9d..00000000 --- a/functions/apps/spotify +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# Spotify -function spotify { - # Variables - NAME="Spotify" - PACKAGE=spotify-client - LIST=spotify.list - KEYID='BBEBDCB318AD50EC6865090613B00F1FD2C19886' - KEYSERVER='hkp://keyserver.ubuntu.com:80' - REPO='deb http://repository.spotify.com stable non-free' - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Check if key already exists in keyring - KEYCHECK=$(apt-key --list-keys | grep -w ${KEYID}) - if [ "" == "$KEYCHECK" ]; then - # Add the repository signing key to be able to verify downloaded packages - echo_message info 'Adding '$NAME' signing key to keyring...' - # Import Key - elevate_privilege "apt-key adv --keyserver $KEYSERVER --recv-keys $KEYID" - # Done - echo_message success "Installation of '$PACKAGE' complete." - else - echo_message info $NAME 'signing key already in keyring.' - fi - # Check if repository already exists - echo_message info 'Checking if '$NAME' repository is already added...' - if [ ! -f /etc/apt/sources.list.d/${LIST} ]; then - # Add the repository - echo_message info 'Adding '$NAME' repository to software sources...' - # Write repository to apt sources list file - echo $REPO | elevate_privilege "tee /etc/apt/sources.list.d/${LIST}" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - else - echo_message info $NAME 'repository already in software sources.' - fi - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/steam b/functions/apps/steam deleted file mode 100644 index a00acbd7..00000000 --- a/functions/apps/steam +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Steam -function steam { - # Variables - NAME="Steam" - PACKAGE=steam - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O http://repo.steampowered.com/steam/archive/precise/steam_latest.deb - ;; - x86_64) - curl -O http://repo.steampowered.com/steam/archive/precise/steam_latest.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Install dependencies - echo_message info 'Installing '$NAME' dependencies...' - elevate_privilege "apt install -y libgl1-mesa-glx libgl1-mesa-dev libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libc6:i386" - # Cleanup and finish - rm $PACKAGE*.deb - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/apps/sublime b/functions/apps/sublime deleted file mode 100644 index ba80b092..00000000 --- a/functions/apps/sublime +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -# Download function for ease of reuse -function install_sublime { - # Install - echo_message info 'Downloading '$NAME'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://download.sublimetext.com/sublime-text_build-${BUILD}_i386.deb - ;; - x86_64) - curl -O https://download.sublimetext.com/sublime-text_build-${BUILD}_amd64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Create symbolic link - echo_message info 'Creating symbolic link...' - elevate_privilege "ln -sf /opt/sublime_text/sublime_text /usr/bin/sublime" - # Cleanup and finish - rm ${PACKAGE}*.deb - echo_message success "Installation of '$PACKAGE' complete." -} - - -# Sublime Text 3 -function sublime { - # Variables - NAME="Sublime Text 3" - PACKAGE=sublime-text - BUILD=3143 - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - install_sublime - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - VERSCHECK=$(dpkg-query -W --showformat='${Version}\n' $PACKAGE) - if [ "$BUILD" == "$VERSCHECK" ]; then - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - else - # Update - echo_message info $NAME '$NAME is already installed, but out-of-date.' - echo_message info 'Updating '$NAME'...' - # Install - install_sublime - whiptail --title "Finished" --msgbox "Updating of $NAME complete." 8 64 - thirdparty - fi - fi -} diff --git a/functions/apps/synergy b/functions/apps/synergy deleted file mode 100644 index 912c59e2..00000000 --- a/functions/apps/synergy +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# Download function for ease of reuse -function install_synergy { - # Install - echo_message info 'Downloading '$NAME' version '$VERSION'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://binaries.symless.com/v${VERSION}/synergy-v${VERSION}-stable-${BUILD}-Linux-i686.deb - - ;; - x86_64) - curl -O https://binaries.symless.com/v${VERSION}/synergy-v${VERSION}-stable-${BUILD}-Linux-x86_64.deb - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install package(s) - echo_message info 'Installing '$NAME'...' - elevate_privilege "dpkg -i $PACKAGE*.deb" - elevate_privilege "apt install -fy" - # Cleanup and finishh - rm ${PACKAGE}*.deb - echo_message success "Installation of '$PACKAGE' complete." -} - - -# Synergy -function synergy { - # Variables - PACKAGE=synergy - VERSION=1.8.8 - BUILD=25a8cb2 - NAME="Synergy" - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - install_synergy - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - VERSCHECK=$(dpkg-query -W --showformat='${Version}\n' $PACKAGE) - if [ "$BUILD" == "$VERSCHECK" ]; then - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - else - # Update - echo_message info $NAME '$NAME is already installed, but out-of-date.' - echo_message info 'Updating '$NAME'...' - # Install - install_synergy - whiptail --title "Finished" --msgbox "Updating of $NAME complete." 8 64 - thirdparty - fi - fi -} \ No newline at end of file diff --git a/functions/apps/telegram b/functions/apps/telegram deleted file mode 100644 index d6b09e88..00000000 --- a/functions/apps/telegram +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# Telegram -function telegram { - # Variables - NAME="Telegram" - TARBALL=tsetup - VERSION=1.1.23 - # Start - echo_message header 'Begin '$NAME' installation' - # Download - echo_message info 'Downloading tarball for version '$VERSION'...' - # Download Debian file that matches system architecture - case `uname -i` in - i386|i486|i586|i686) - curl -O https://updates.tdesktop.com/tlinux32/tsetup32.${VERSION}.tar.xz - ;; - x86_64) - curl -O https://updates.tdesktop.com/tlinux/tsetup.${VERSION}.tar.xz - ;; - *) - whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 - ;; - esac - # Install - install_telegram - # Finish - echo_message success "Installation of '$NAME' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty -} - -function install_telegram { - # Unpack tarball to /opt - echo_message info 'Unpacking '$NAME' tarball...' - elevate_privilege "tar -xf ${TARBALL}*.tar.xz -C /opt/" - echo_message success 'Done.' - # Create .desktop fle - echo_message info 'Creating .desktop file for $NAME...' -echo "[Desktop Entry] -Version=$VERSION -Name=$NAME - -Exec=/opt/Telegram/Telegram -Terminal=false -Icon=telegram -Type=Application" >> $NAME.desktop - # Move .desktop file - elevate_privilege "mv -f $NAME.desktop /usr/share/applications/" - elevate_privilege "chown root /usr/share/applications/$NAME.desktop" - echo_message success 'Done.' - # Fetch icon - echo_message info 'Fetching $NAME icon...' - curl -O https://telegram.org/img/t_logo.png - elevate_privilege "mv -f t_logo.png /usr/share/icons/hicolor/256x256/apps/telegram.png" - elevate_privilege "gtk-update-icon-cache /usr/share/icons/hicolor" - echo_message success 'Done.' - # Cleanup and finish - rm ${TARBALL}*.tar.gz -} diff --git a/functions/apps/vlc b/functions/apps/vlc deleted file mode 100644 index 286508b4..00000000 --- a/functions/apps/vlc +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# VLC -function vlc { - # Variables - NAME="VLC Player" - PACKAGE=vlc - PPANAME=ppa:videolan/master-daily - # Install - echo_message header 'Begin '$NAME' installation' - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed.' - echo 'Proceeding' - # Add repository - echo_message info 'Adding '$NAME' repository to software sources...' - elevate_privilege "add-apt-repository -y $PPANAME" - # Update repository information - echo_message info 'Updating repository information...' - elevate_privilege "apt update -y" - echo_message success "Installation of '$PACKAGE' complete." - # Install - echo_message info 'Installing '$NAME'...' - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "Installation of '$PACKAGE' complete." - whiptail --title "Finished" --msgbox "Installation of $NAME complete." 8 64 - thirdparty - else - # Already installed - echo_message info $NAME 'already installed.' - whiptail --title "Finished" --msgbox "$NAME is already installed." 8 64 - thirdparty - fi -} \ No newline at end of file diff --git a/functions/check b/functions/check deleted file mode 100755 index 0e5dc69a..00000000 --- a/functions/check +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -# Check if command failed, if true abort -function check_fail { - if [[ $EXITSTATUS != 0 ]]; then - echo_message error "Last command returned an error; something may have went wrong. Aborting..." && sleep 2 && exit 99 - fi -} - -# Check if package is installed -function check_packages() { - dpkg-query -W --showformat='${Status}\n' $@ | grep "install ok installed" &> /dev/null -} - -# Check for and install required packages for this script set. -function check_dependencies { - # Check list - DEPS=$(dirname "$0")'/data/dependencies.list' - for PACKAGE in $(cat $DEPS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - if [ $EXITSTATUS = 1 ]; then - echo_message warning "Dependency '$PACKAGE' is not present on your system and is required to continue." - echo_message question 'Would you like to install it now? (Y)es, (N)o :' && read REPLY - case $REPLY in - # Positive action - [Yy]* ) - echo_message info "Installing '$PACKAGE' installed. Proceeding." - # Admin privileges - sudo apt install -y $PACKAGE - echo_message success "Package '$PACKAGE' installed. Proceeding." - ;; - # Negative action - [Nn]* ) - echo_message warning "Required dependencies are not present. :/" - echo "Exiting..." - exit 99 - ;; - # Error - * ) - echo_message error '\aInvalid response, please try again.' && check_dependencies - ;; - esac - else - echo "Dependency '$PACKAGE' is installed." - fi - done - echo_message success "Dependencies are installed. :)" - echo "Proceeding." -} - -# Check which distribution the user is running -function check_distribution { - EXITSTATUS=$(which lsb_release &>/dev/null; echo $?) - if [[ $EXITSTATUS != 0 ]]; then - echo_message error "\aCan't check which distribution you are using! Aborting." - echo_message error " Aborting..." && sleep 3 && exit 99 - else - if lsb_release -ds | grep -qE '(Ubuntu)'; then - echo 'Current distribution is: '$(lsb_release -ds) - echo_message success "You are using Ubuntu. :D" - echo "Proceeding." - elif lsb_release -ds | grep -qE '(Mint|elementary)'; then - echo 'Current distribution is: '$(lsb_release -ds) - echo_message success "You are using an Ubuntu-based distribution. It's probably fine. :)" - echo "Proceeding." - elif lsb_release -ds | grep -q 'Debian'; then - echo 'Current distribution is: '$(lsb_release -ds) - echo_message warning "You are using Debian. This is not recommended. Some functions may not work and require tweaking. :/" - echo "Proceeding nonetheless." - else - echo_message error "\aYou appear to be using a distribution which is not compatible with this script! :(" - echo_message error "Proceeding might break the system. Aborting..." && sleep 3 && exit 99 - fi - fi -} - -# Check if current user is in the sudo group -function check_privileges { - # Check if user is root - if [[ $EUID != 0 ]]; then - EXITSTATUS=$(groups $USER | grep -q 'sudo'; echo $?) - if [[ $EXITSTATUS != 0 ]]; then - echo_message error "Your user account doesn't have authorization to use these scripts with this computer. Log in as root or as a user with admin privileges." - echo_message info "Exiting..." - sleep 5 && exit 99 - fi - # Current user can use 'sudo' - echo_message success "Current user has sudo privileges. :)" - echo "Proceeding." - SUDOCMD="sudo" - else - # Display warning about being root user - echo_message warning "You are logged in as the root user. This is not recommended. :/" - if (whiptail --title "Root User" --yesno "You are logged in as the root user. This is mostly fine, but not recommended.\n\nAre you sure you want to proceed?" 8 64) then - echo "Proceeding." - SUDOCMD= - else - echo "Exiting..." - exit 99 - fi - fi -} - -function check { - # Check - echo_message title "Starting 'check' function..." - # Check sudo - echo_message info "Checking administrative privileges of current user..." - check_privileges - # Check distro - echo_message info "Checking distribution information..." - check_distribution - # Check dependencies - echo_message info "Checking if dependencies are installed..." - check_dependencies - # Done - echo_message success "Check complete." -} \ No newline at end of file diff --git a/functions/checks b/functions/checks new file mode 100755 index 00000000..8b8230be --- /dev/null +++ b/functions/checks @@ -0,0 +1,190 @@ +#!/bin/bash + +# Check if package is installed +function check_packages() { + dpkg-query -W --showformat='${Status}\n' $@ | grep "install ok installed" &> /dev/null +} + +# Check if package is installed +function check_package() { + # echo_message header "Starting 'check_package' function" + dpkg-query -W --showformat='${Status}\n' $1 | grep "install ok installed" &> /dev/null + # if not installed + if [ $? = 1 ]; then + # draw window + if (whiptail \ + --title "Install ${1}" \ + --yesno "This function requires '${1}' but it is not present on your system. \n\nWould you like to install it to continue? " 10 64) then + # Install + echo_message info "Installing '${3}'..." + elevate_privilege "apt install -y ${1}" + # Finished + echo_message success "$1 is installation complete." + whiptail --title "Finished" --msgbox "Installation of ${1} Flatpak complete." 8 64 + $2 + else + # Cancelled + echo_message info "Installation of ${1} cancelled." + $2 + fi + else + echo_message info "Function dependency '${1}' is installed." + fi +} + +# Check for Flatpak repository +function check_flatpak_repo { + # echo_message header "Starting 'check_flatpak_repo' function" + # Check if already added + flatpak remotes | grep $1 &> /dev/null + # If repo is added + if [ $? = 1 ]; then + # draw window + if (whiptail \ + --title "Add ${1} Repository" \ + --yesno "This function requires '${1^}' repository but it is not present on your system. \n\nWould you like to add it to continue? " 10 64) then + # Add repository + echo_message info "Adding flatpak repository..." + flatpak remote-add --if-not-exists $1 $2 + echo_message success "Repository added." + whiptail --title "Finished" --msgbox "The ${1^} repository has been added." 8 56 + else + # Cancelled + echo_message info "Addition of ${1^} repository cancelled." + $3 + fi + else + echo_message info "${1^} repository already added." + fi +} + +# Check which distribution the user is running +function check_os { + echo_message header "Starting 'check_os' function" + echo_message title "Checking which OS you are using..." + # Variables + OS_NAME="Linux" + # Check if Linux + echo_message info "Current OS is: "$(uname) + if [[ $(uname) != "$OS_NAME" ]]; then + echo_message error "You don't appear to be using $OS_NAME! Aborting. :(" + exit 99 + else + echo_message success "You are using '$OS_NAME'. :D" + fi +} + +# Check which distribution the user is running +function check_distribution { + EXITSTATUS=$(which lsb_release &>/dev/null; echo $?) + if [[ $EXITSTATUS != 0 ]]; then + echo_message error "\aCan't check which distribution you are using! Aborting." + echo_message error " Aborting..." && sleep 3 && exit 99 + else + if lsb_release -ds | grep -qE '(Ubuntu)'; then + echo 'Current distribution is: '$(lsb_release -ds) + echo_message success "You are using Ubuntu. :D" + echo "Proceeding." + elif lsb_release -ds | grep -qE '(Mint|elementary)'; then + echo 'Current distribution is: '$(lsb_release -ds) + echo_message success "You are using an Ubuntu-based distribution. It's probably fine. :)" + echo "Proceeding." + elif lsb_release -ds | grep -q 'Debian'; then + echo 'Current distribution is: '$(lsb_release -ds) + echo_message warning "You are using Debian. This is not recommended. Some functions may not work. :/" + echo "Proceeding nonetheless." + else + echo_message warning "You are using a distribution that may not be compatible with this script set." + echo_message warning "Proceeding may break your system." + echo_message question "Are you sure you want to continue? (Y)es, (N)o : " && read REPLY + case $REPLY in + # Positive action + [Yy]* ) + echo_message warning "You have been warned." + ;; + # Negative action + [Nn]* ) + echo_message info "Exiting..." + exit 99 + ;; + # Error + * ) + echo_message error 'Sorry, try again.' && check_distribution + ;; + esac + fi + fi +} + +# Check for and install if missing the required packages for this script set. +function check_dependencies { + echo_message header "Starting 'check_dependencies' function" + echo_message title "Checking if necessary dependencies are installed..." + # Variables + LIST=$(dirname "$0")'/data/dependencies.list' + # Check dependencies + for PACKAGE in $(cat $LIST); do + # Check if package is installed + if [ $(check_packages $PACKAGE; echo $?) = 1 ]; then + echo_message info "This script requires '$PACKAGE' and it is not present on your system." + echo_message question 'Would you like to install it to continue? (Y)es, (N)o : ' && read REPLY + case $REPLY in + # Positive action + [Yy]* ) + echo_message warning "Requires root privileges" + sudo dnf -y install $PACKAGE + echo_message success "Package '$PACKAGE' installed." + ;; + # Negative action + [Nn]* ) + echo_message info "Exiting..." + exit 99 + ;; + # Error + * ) + echo_message error 'Sorry, try again.' && check_dependencies + ;; + esac + else + echo_message info "Dependency '$PACKAGE' is installed." + fi + done + echo_message success "All dependencies are installed. :)" +} + +# Check if current user is in the sudo group +function check_privileges { + echo_message header "Starting 'check_privileges' function" + echo_message title "Checking administrative privileges of current user..." + # Check if user is root + if [[ $EUID != 0 ]]; then + if [[ $(groups $USER | grep -q 'sudo'; echo $?) != 0 ]]; then + echo_message error "This user account doesn't have admin privileges." + echo_message info "Log in as a user with admin privileges to be able to much of these scripts.." + echo_message info "Exiting..." + sleep 5 && exit 99 + else + # Current user can use 'sudo' + echo_message success "Current user has sudo privileges. :)" + fi + else + if (whiptail --title "Root User" --yesno "You are logged in as the root user. This is not recommended.\n\nAre you sure you want to proceed?" 8 56) then + echo_message warning "You are logged in as the root user. This is not recommended. :/" + else + echo_message info "Exiting..." + exit 99 + fi + fi +} + +# Run system checks +function system_checks { + # Check OS + check_os + # Check distribution + check_distribution + # Check sudo + check_privileges + # Check dependencies + check_dependencies +} \ No newline at end of file diff --git a/functions/cleanup b/functions/cleanup deleted file mode 100755 index bbe6982f..00000000 --- a/functions/cleanup +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# -# Update the list of packages in 'data/purge.list' to suit your preferences -# Listed packages that are are not any system-crucial software to avoid breakage - -# Remove unused preinstalled apps -function purge_unused { - echo_message title "Starting 'purge_unused' function..." - # Check list - PURGED=$(dirname "$0")'/data/purge.list' - # Draw window - if (eval `resize` && whiptail \ - --title "Remove Un-used Pre-installed Applications" \ - --yesno "Current list of pre-installed applications to remove: \n\n$(for LINE in $(cat $PURGED); do echo ' '$LINE; done) \n\nAre you sure you want proceed?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext ) then - # Remove loop - echo_message info 'Removing unused pre-installed applications...' - for PACKAGE in $(cat $PURGED); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Show already installed message - echo "Package '$PACKAGE' is already removed." - else - # Remove package - echo_message info "'$PACKAGE' is installed. Removing..." - # Admin privileges - elevate_privilege "apt purge -y $PACKAGE" - # Done - echo_message success "'$PACKAGE' removal is complete." - fi - done - # Done - echo_message success 'Removal of unused packages complete.' - whiptail --title "Finished" --msgbox "Your list of unwanted pre-installed applications have been removed." 8 64 - cleanup - else - cleanup - fi -} - -# Remove Orphaned Packages -function remove_orphans { - echo_message title "Starting 'remove_orphans' function..." - echo_message info 'Removing orphaned packages...' - # Admin privileges - elevate_privilege "apt autoremove -y $PACKAGE" - # Done - echo_message success 'Removal of orphaned packages complete.' - whiptail --title "Finished" --msgbox "Orphaned packages have been successfully removed." 8 64 - cleanup -} - -# Remove Leftover Config files -function remove_leftover_config { - echo_message title "Starting 'remove_leftover_config' function..." - echo_message info 'Removing leftover configuration files...' - # Admin privileges - elevate_privilege "dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | cut -d ' ' -f 2)" - # Done - echo_message success 'Removal of leftover configuration files complete.' - whiptail --title "Finished" --msgbox "Leftover configuration files have been removed." 8 64 - cleanup -} - -# Clean apt cache -function clean_apt_cache { - echo_message title "Starting 'clean_apt_cache' function..." - echo_message info 'Cleaning package cache...' - # Admin privileges - elevate_privilege "apt clean" - # Done - echo_message success 'Package cache cleaned.' - whiptail --title "Finished" --msgbox "Package cache has been cleaned." 8 64 - cleanup -} - -# Cleanup System -function cleanup { - echo_message title "Starting 'cleanup' function..." - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - # Draw window - $(eval `resize`&& whiptail \ - --notags \ - --title "System Cleanup" \ - --menu "\nWhat would you like to do?" \ - --cancel-button "Go Back" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - clean_apt_cache 'Clean package cache' \ - remove_leftover_config 'Remove leftover configuration files' \ - remove_orphans 'Remove orphaned packages' \ - purge_unused 'Remove unused pre-installed packages' \ - 3>&1 1>&2 2>&3) - else - main - fi -} \ No newline at end of file diff --git a/functions/codecs b/functions/codecs deleted file mode 100755 index c857aca2..00000000 --- a/functions/codecs +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Install non-free multimedia codecs using the list 'data/codec.list' -function codecs { - echo_message title "Starting 'codecs' function..." - # Check list - CODECS=$(dirname "$0")'/data/codecs.list' - # Draw window - if (eval `resize` && whiptail \ - --title "Multimedia Codecs" \ - --yesno "Current list of non-free codecs to install: \n\n$(for LINE in $(cat $CODECS); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - # Install loop - echo_message info 'Installing non-free codecs...' - for PACKAGE in $(cat $CODECS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - main - else - main - fi -} \ No newline at end of file diff --git a/functions/configure b/functions/configure deleted file mode 100755 index f2523fcc..00000000 --- a/functions/configure +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - - -# Automatically set preferred gsettings keys as outlined in the 'gsettings.list' file -# 'gsettings' can be obtained by executing "dconf watch /" and then manually changing settings -function set_preferences { - # Check list - GSETTINGS=$(dirname "$0")'/data/gsettings.list' - echo_message info 'Setting preferred application-specific & desktop settings...' - while IFS= read line - do - eval 'gsettings set' $line - done < "$GSETTINGS" - # Done - echo_message success 'Settings changed successfully.' - whiptail --title "Finished" --msgbox "Settings changed successfully." 8 64 - configure -} - -# Set preferred bash aliased by copying the 'aliases.list' file to ~/.bash_aliases -function set_bash_aliases { - # Check list - ALIASES=$(dirname "$0")'/data/aliases.list' - # Draw window - if (eval `resize` && whiptail \ - --title "Preferred Bash Aliases" \ - --yesno "Current list of preferred bash aliases: \n\n$(while read LINE; do echo " "$LINE; done < $ALIASES) \n\nProceed?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - echo_message info 'Setting bash aliases...' - # simply copy the list file to the aliases file - cp $ALIASES ~/.bash_aliases - echo_message success 'Bash aliases set successfully.' - whiptail --title "Finished" --msgbox "Bash aliases set successfully." 8 64 - configure - else - configure - fi -} - -# Show start-up all start-up applications by modifying the 'NoDisplay' line of their .desktop files -function display_startup_apps { - echo_message info 'Changing display of startup applications...' - # Admin privileges - elevate_privilege "sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop" - # Done - echo_message success 'Settings changed successfully.' - whiptail --title "Finished" --msgbox "Settings changed successfully." 8 64 - configure -} - -# Disable Apport -function disable_apport { - echo_message info 'Disabling apport crash dialogs...' - # Admin privileges - elevate_privilege "sed -i 's/enabled=1/enabled=0/g' /etc/default/apport" - # Done - echo_message success 'Settings changed successfully.' - whiptail --title "Finished" --msgbox "Settings changed successfully." 8 64 - configure -} - -# Configure System -function configure { - echo_message title "Starting 'configure' function..." - # check exit status - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - # Draw window - $(eval `resize` && whiptail \ - --notags \ - --title "Configure System" \ - --menu "\nWhat would you like to do?" \ - --cancel-button "Go Back" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - set_preferences 'Set preferred application-specific & desktop settings' \ - set_bash_aliases 'Set preferred bash aliases' \ - display_startup_apps 'Show all startup applications' \ - disable_apport 'Disable system crash dialogs' \ - 3>&1 1>&2 2>&3) - else - main - fi -} diff --git a/functions/development b/functions/development deleted file mode 100755 index abb7b1a3..00000000 --- a/functions/development +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# Update the list of packages in 'data/development.list' to suit your preferences - -# Install preferred development apps -function development { - echo_message title "Starting 'development' function..." - # Check list - DEVTOOLS=$(dirname "$0")'/data/development.list' - # Draw window - if (eval `resize` && whiptail \ - --title "Preferred Development Applications" \ - --yesno "Current list of preferred development tools to install: \n\n$(for LINE in $(cat $DEVTOOLS); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - echo_message info 'Installing preferred development applications...' - # Install loop - for PACKAGE in $(cat $DEVTOOLS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finished - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - main - else - main - fi -} \ No newline at end of file diff --git a/functions/elevate_privilege b/functions/elevate_privilege new file mode 100755 index 00000000..e9fa8c02 --- /dev/null +++ b/functions/elevate_privilege @@ -0,0 +1,60 @@ +#!/bin/bash +# +# accept user passwords and pass them to another command that requires elevated privilege + +function elevate_privilege() { + echo_message header "Starting 'elevate_privilege' function" + # check if current user is root + if [[ $EUID = 0 ]]; then + echo_message warning "You are logged in as the root user. Again, this is not recommended. :/" + # Running command without sudo + $@ + else + # check sudo uptime to see if a password is needed + if [ $(sudo -n uptime 2>&1 | grep 'a password is required' | wc -l) != 0 ]; then + echo_message warning 'Admin privileges required.' + # Draw window + PASSWORD=$(whiptail --title "Password Required" --passwordbox "\nRequires admin privileges to continue. \n\nPlease enter your password:\n" 12 48 3>&1 1>&2 2>&3) + if [ $? = 0 ]; then + # while loop for sudo attempts + COUNT=0 + MAXCOUNT=3 + while [ $COUNT -lt $MAXCOUNT ]; do + # check if sudo command fails + if [[ $(sudo -S <<< "$PASSWORD" echo) -ne 0 ]]; then + echo_message warning "Incorrect password." + # Prompt for password again + PASSWORD=$(whiptail --title "Password Error" --passwordbox "\nThe password you provided was not correct.\n\nPlease enter your password again:\n" 12 48 3>&1 1>&2 2>&3) + # Abort if user cancels + if [ $? = 1 ]; then + # Error message if user cancels + echo_message error "Password prompt cancelled. Aborting..." + main + fi + # Increase the count + let COUNT=COUNT+1 + # Error message if too many attempts + if [[ "$COUNT" -eq "$MAXCOUNT" ]]; then + echo_message error "Too many failed password attempts. Aborting..." + whiptail --msgbox "Too many failed password attempts. Please try again." --title "Oops" 8 56 + main + fi + else + # pass the command to sudo + sudo $@ + break + fi + done + else + # Error message if user cancels + echo_message error "Password prompt cancelled. Aborting..." + whiptail --msgbox "Password is required to proceed. Please try again." --title "Oops" 8 56 + main + fi + else + echo_message info "Admin privileges not required at this time." + # pass the command to sudo + sudo $@ + fi + fi +} \ No newline at end of file diff --git a/functions/favs b/functions/favs deleted file mode 100755 index 36818da0..00000000 --- a/functions/favs +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# Update the list of packages in 'data/favs.list' to suit your preferences - -# Install preferred applications -function favs { - echo_message title "Starting 'favs' function..." - # Import list - FAVS=$(dirname "$0")'/data/favs.list' - # Draw Window - if (eval `resize` && whiptail \ - --title "Preferred Applications" \ - --yesno "Current list of preferred applications to install: \n\n$(for LINE in $(cat $FAVS); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - # Install loop - echo_message info 'Installing preferred applications...' - for PACKAGE in $(cat $FAVS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - main - else - main - fi -} - diff --git a/functions/fonts b/functions/fonts deleted file mode 100644 index 2aaac4df..00000000 --- a/functions/fonts +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# Update the list of packages in 'data/fonts.list' to suit your preferences - -# Install preferred fonts -function install_fonts { - echo_message title "Starting 'install_fonts' function..." - # Check list - FONTLIST=$(dirname "$0")'/data/fonts.list' - # Draw window - if (eval `resize` && whiptail \ - --title "Preferred Fonts" \ - --yesno "Current list of preferred fonts to install: \n\n$(for LINE in $(cat $FONTLIST); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - # Install loop - echo_message info 'Installing preferred fonts...' - for PACKAGE in $(cat $FONTLIST); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - fonts - else - fonts - fi -} - -# Install Microsoft Core Fonts -function msttcorefonts { - echo_message title "Starting 'msttcorefonts' function..." - # Variables - PACKAGE=ttf-mscorefonts-installer - NAME="Microsoft Core Fonts" - # Check if already installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - echo_message info $NAME 'is not installed. Installing...' - if (whiptail --title "Microsoft Core Fonts" --yesno "Install Microsoft Windows core fonts to extend font support?" 8 64) then - # Install - echo_message info 'Installing...' - # Admin privileges - elevate_privilege "apt install -y $PACKAGE" - # Finished - echo_message success "'$NAME' is installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - fonts - else - fonts - fi - else - # Already installed - echo $NAME 'installed.' - whiptail --title "Finished" --msgbox "$NAME are installed." 8 64 - fonts - fi -} - -# Install Fonts -function fonts { - echo_message title "Starting 'fonts' function..." - # check exit status - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - # Draw window - $(eval `resize` && whiptail \ - --notags \ - --title "Install Fonts" \ - --menu "\nWhat would you like to do?" \ - --cancel-button "Go Back" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - install_fonts 'Install favourite fonts' \ - msttcorefonts 'Install Microsoft core fonts' \ - 3>&1 1>&2 2>&3) - else - main - fi -} \ No newline at end of file diff --git a/functions/gnome b/functions/gnome deleted file mode 100644 index e9953da8..00000000 --- a/functions/gnome +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -# Add GNOME PPA -function upgrade_gnome { - PPA=ppa:gnome3-team/gnome3 - echo_message title "Starting 'upgrade_gnome' function..." - # Add repository - echo_message info 'Adding GNOME3 PPA to software sources...' - # Admin privileges - elevate_privilege "add-apt-repository -y $PPA" - # Update repository information - echo_message info 'Updating repository information...' - # Admin privileges - elevate_privilege "apt update -y" - echo_message success 'Done.' - # Upgrade GNOME - echo_message info 'Upgrading GNOME software...' - # Admin privileges - elevate_privilege "apt dist-upgrade -y" - echo_message success "Upgrade complete." - gnome -} - -# Install GNOME Desktop -function install_gnome_desktop { - echo_message title "Starting 'install_gnome_desktop' function..." - # Check list - GNOMEDESKTOP=$(dirname "$0")'/data/gnome-desktop.list' - # Draw window - if (eval `resize` && whiptail \ - --title "GNOME Desktop" \ - --yesno "Packages to install for a basic GNOME desktop: \n\n$(for LINE in $(cat $GNOMEDESKTOP); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext) then - # Install loop - echo_message info 'Installing GNOME desktop...' - for PACKAGE in $(cat $GNOMEDESKTOP); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - gnome - else - gnome - fi -} - -# Install GNOME Core Apps -function install_gnome_apps { - echo_message title "Starting 'install_gnome_apps' function..." - # Check list - GNOMEAPPS=$(dirname "$0")'/data/gnome-apps.list' - # Draw window - if (eval `resize` && whiptail \ - --title "GNOME Core Apps" \ - --yesno "Current list of GNOME core apps: \n\n$(for LINE in $(cat $GNOMEAPPS); do echo ' '$LINE; done) \n\nWould you like to install these apps?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext ) then - # Install loop - echo_message info 'Installing GNOME core apps...' - for PACKAGE in $(cat $GNOMEAPPS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "GNOME Apps are installed complete." 8 64 - gnome - else - gnome - fi -} - -# GNOME -function gnome { - echo_message title "Starting 'gnome' function..." - # check exit status - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - # Draw window - $(eval `resize` && whiptail \ - --notags \ - --title "Install Latest GNOME" \ - --menu "\nWhat would you like to do?" \ - --cancel-button "Go Back" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - upgrade_gnome 'Update to latest GNOME' \ - install_gnome_desktop 'Install basic GNOME desktop' \ - install_gnome_apps 'Install GNOME core applications' \ - 3>&1 1>&2 2>&3) - else - main - fi -} \ No newline at end of file diff --git a/functions/install_flatpak_apps b/functions/install_flatpak_apps new file mode 100644 index 00000000..9ea9aa04 --- /dev/null +++ b/functions/install_flatpak_apps @@ -0,0 +1,66 @@ +#!/bin/bash + +# install gimp +function install_flatpak_gimp { + # check if flathub repo is added + check_flatpak_repo "flathub" "https://flathub.org/repo/flathub.flatpakrepo" install_flatpak_apps + #install_flatpak_package "Name" "source" "com.package.Name" return_function + install_flatpak_package "GIMP" "flathub" " org.gimp.GIMP" install_flatpak_apps +} + +# install peek +function install_flatpak_peek { + # check if flathub repo is added + check_flatpak_repo "flathub" "https://flathub.org/repo/flathub.flatpakrepo" install_flatpak_apps + #install_flatpak_package "Name" "source" "com.package.Name" return_function + install_flatpak_package "Peek" "flathub" " com.uploadedlobster.peek" install_flatpak_apps +} + +# install riot +function install_flatpak_riot { + # check if flathub repo is added + check_flatpak_repo "flathub" "https://flathub.org/repo/flathub.flatpakrepo" install_flatpak_apps + #install_flatpak_package "Name" "source" "com.package.Name" return_function + install_flatpak_package "Riot" "flathub" " im.riot.Riot" install_flatpak_apps +} + +# install steam +function install_flatpak_steam { + # check if flathub repo is added + check_flatpak_repo "flathub" "https://flathub.org/repo/flathub.flatpakrepo" install_flatpak_apps + #install_flatpak_package "Name" "source" "com.package.Name" return_function + install_flatpak_package "Steam" "flathub" "com.valvesoftware.Steam" install_flatpak_apps +} + + +# Install Flatpak Applications +function install_flatpak_apps { + # check if flatpak is installed + check_package "flatpak" main + # install + NAME="Flatpak Applications" + echo_message title "Starting installation of ${NAME,,}..." + # Draw window + FLATPAKAPPS=$(eval `resize` && whiptail \ + --notags \ + --title "Install $NAME" \ + --menu "\nWhat ${NAME,,} would you like to install?" \ + --ok-button "Install" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + 'install_flatpak_gimp' 'GIMP' \ + 'install_flatpak_peek' 'Peek' \ + 'install_flatpak_riot' 'Riot' \ + 'install_flatpak_steam' 'Steam' \ + 3>&1 1>&2 2>&3) + + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$FLATPAKAPPS' function..." + $FLATPAKAPPS + else + # Cancelled + echo_message info "Installation of ${NAME,,} cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/install_fonts b/functions/install_fonts new file mode 100755 index 00000000..ad042c61 --- /dev/null +++ b/functions/install_fonts @@ -0,0 +1,34 @@ +#!/bin/bash + +# Install preferred fonts +function install_favs_fonts { + # Update the list of packages in 'data/favs-fonts.list' to suit your preferences + install_from_list favs-fonts "preferred fonts" install_fonts +} + +# Install Microsoft Core Fonts +function install_mscorefonts { + # Update the list of packages in 'data/favs-fonts.list' to suit your preferences + install_package ttf-mscorefonts-installer "Microsoft Core Fonts" install_fonts +} + +# Install Fonts +function install_fonts { + echo_message title "Starting 'fonts' function..." + # check exit status + EXITSTATUS=$? + if [ $EXITSTATUS = 0 ]; then + # Draw window + $(eval `resize` && whiptail \ + --notags \ + --title "Install Fonts" \ + --menu "\nWhat would you like to do?" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + install_favs_fonts 'Install favourite fonts' \ + install_mscorefonts 'Install Microsoft core fonts' \ + 3>&1 1>&2 2>&3) + else + main + fi +} \ No newline at end of file diff --git a/functions/install_functions b/functions/install_functions new file mode 100755 index 00000000..2b626552 --- /dev/null +++ b/functions/install_functions @@ -0,0 +1,206 @@ +#!/bin/bash + +# Install preferred apps +function install_favs { + # Update the list of packages in 'data/favs.list' to suit your preferences + install_from_list favs "preferred applications" main +} + +# Install preferred development tools +function install_favs_dev { + # Update the list of packages in 'data/favs-dev.list' to suit your preferences + install_from_list favs-dev "preferred development tools" main +} + +# Install preferred utilities +function install_favs_utils { + # Update the list of packages in 'data/favs-utils.list' to suit your preferences + install_from_list favs-utils "preferred utilities" main +} + +# Install preferred GNOME apps +function install_codecs { + # Update the list of packages in 'data/codecs.list' to suit your preferences + install_from_list codecs "multimedia Codes" main +} + +# Install from list +function install_from_list() { + # echo_message header "Starting 'install_from_list' function..." + echo_message title "Starting installation of ${2}..." + # Variables + LIST=$(dirname "$0")'/data/'${1}'.list' + # Draw window + if (eval `resize` && whiptail \ + --title "Install ${2^}" \ + --yesno "Current list of packages that will be installed: \n\n$(cat ${LIST}) \n\nWould you like to proceed?" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + --scrolltext \ + 3>&1 1>&2 2>&3) then + # Install loop + for PACKAGE in $(cat $LIST); do + # Check if package is installed + if [ $(check_packages $PACKAGE; echo $?) = 1 ]; then + # Install package + echo_message warning "Package '$PACKAGE' is not installed. Installing..." + # Admin privileges + elevate_privilege "apt install -y $PACKAGE" + # Check if failed + if [[ $? != 0 ]]; then + echo_message error "Error installing '$PACKAGE'." + fi + else + # Show already installed message + echo_message info "Package '$PACKAGE' is installed." + fi + done + # Finished + echo_message success "Installation of ${2} complete." + whiptail --title "Finished" --msgbox "Installation of ${2} is complete." 8 56 + $3 + else + # Cancelled + echo_message info "Installation of ${2} cancelled." + $3 + fi +} + +# Install single package +function install_package() { + echo_message header "Starting 'install_package' function..." + # Check if already installed + dpkg-query -W --showformat='${Status}\n' $2 | grep "install ok installed" &> /dev/null + # If package is not installed + if [ $? = 1 ]; then + echo_message info "${1} is not installed. Installing..." + if (whiptail --title "Install ${1}" --yesno "Are you sure you want to proceed with installation?" 8 64) then + # Install + echo_message info "Installing '${2}'..." + # Admin privileges + elevate_privilege "apt install -y ${2}" + # Finished + echo_message success "Installation of package '${2}' is complete." + whiptail --title "Finished" --msgbox "Installation of ${1} complete." 8 64 + # return + $3 + else + # Cancelled + echo_message info "Installation of ${1} cancelled." + # return + $3 + fi + else + # Already installed + echo_message info "Package '${2}' is installed." + whiptail --title "Finished" --msgbox "Installation of ${1} is complete." 8 64 + # return + $3 + fi +} + +# Install single remote package +function install_remote_package() { + echo_message header "Starting 'install_remote_package' function..." + # Check if package is installed + dpkg-query -W --showformat='${Status}\n' $2 | grep "install ok installed" &> /dev/null + # If package is not installed + if [ $? = 1 ]; then + echo_message info "$1 is not installed." + # Download Debian file that matches system architecture + case `uname -i` in + i386|i486|i586|i686) + # Download 32 bit package + echo_message info "Downloading remote package '${2}_i386.deb' from '$3'..." + curl -O ${3}/${2}_i386.deb + ;; + x86_64) + # Download 64 bit package + echo_message info "Downloading remote package '${2}_amd64.deb' from '$3'..." + curl -O ${3}/${2}_amd64.deb + ;; + *) + whiptail --title "Error." --msgbox "No remote packages available to download." 8 64 + $4 + ;; + esac + # Install package(s) + echo_message info "Installing '$2' package..." + elevate_privilege "dpkg -i $2*.deb" + # Install depencies, if any + echo_message info "Correcting any dependency errors..." + elevate_privilege "apt install -fy" + # Cleanup and finish + rm $2*.deb + # Done + echo_message success "Installation of $1 complete." + whiptail --title "Finished" --msgbox "Installation of $1 complete." 8 64 + $4 + else + # Already installed + echo_message info "$1 already installed." + whiptail --title "Finished" --msgbox "$1 is already installed." 8 64 + $4 + fi +} + + +# Install flatpak package +function install_flatpak_package() { + # echo_message header "Starting 'install_flatpak_package' function..." + # If package is not installed + flatpak list | grep $3 &> /dev/null + if [ $? = 1 ]; then + echo_message info "${1} is not installed. Installing..." + if (whiptail \ + --title "Install ${1}" \ + --yesno "The ${1} Flatpak package is not installed. \n\nProceed with installation of '${3}'?" 10 64) then + # Install + echo_message info "Installing flatpak '${3}'..." + flatpak install -y ${2} ${3} + # Finished + echo_message success "$1 is installation complete." + whiptail --title "Finished" --msgbox "Installation of ${1} Flatpak complete." 8 64 + $4 + else + # Cancelled + echo_message info "Installation of ${1} cancelled." + $4 + fi + else + # Already installed + echo_message info "${3} is already installed." + whiptail --title "Installed" --msgbox "The Flatpak for ${1} is already installed." 8 64 + $4 + fi +} + +# Install snap package +function install_snap_package() { + # echo_message header "Starting 'install_snap_package' function..." + # If package is not installed + snap list | grep $1 &> /dev/null + if [ $? = 1 ]; then + echo_message info "${1} is not installed. Installing..." + if (whiptail \ + --title "Install ${1^}" \ + --yesno "The Snap package for ${1^} is not installed. \n\nProceed with installation of '${1}'?" 10 64) then + # Install + echo_message info "Installing snap '${1}'..." + # Admin privileges + elevate_privilege "snap install ${1}" + # Finished + echo_message success "'${1}' is installation complete." + whiptail --title "Finished" --msgbox "Installation of ${1^} Snap complete." 8 64 + $3 + else + # Cancelled + echo_message info "Installation of ${1^} cancelled." + $3 + fi + else + # Already installed + echo_message info "${1} is already installed." + whiptail --title "Installed" --msgbox "The Snap for ${1^} is already installed." 8 64 + $3 + fi +} \ No newline at end of file diff --git a/functions/install_gnome b/functions/install_gnome new file mode 100644 index 00000000..fe5e8709 --- /dev/null +++ b/functions/install_gnome @@ -0,0 +1,38 @@ +#!/bin/bash + +# Install GNOME Core Apps +function install_gnome_apps { + # Update the list of packages in 'data/gnome-apps.list' to suit your preferences + install_from_list gnome-apps "preferred GNOME apps" install_gnome +} +# Install GNOME Shell Extensions +function install_shell_extensions { + # Update the list of packages in 'data/gnome-shell-extensions.list' to suit your preferences + install_from_list gnome-shell-extensions "preferred GNOME Shell extensions" install_gnome +} + +# Install Codecs +function install_gnome { + NAME="GNOME Software" + echo_message title "Starting $NAME installation..." + # Draw window + GNOME=$(eval `resize` && whiptail \ + --notags \ + --title "Install $NAME" \ + --menu "\nWhich $NAME would you like to install?" \ + --ok-button "Install" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + 'install_gnome_apps' 'GNOME Core Apps' \ + 'install_shell_extensions' 'GNOME Shell Extensions' \ + 3>&1 1>&2 2>&3) + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$GNOME' function" + $GNOME + else + # Cancelled + echo_message info "$NAME installation cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/install_snap_apps b/functions/install_snap_apps new file mode 100644 index 00000000..5bf647fa --- /dev/null +++ b/functions/install_snap_apps @@ -0,0 +1,55 @@ +#!/bin/bash + +# install Atom from snap +function install_snap_atom { + #install_snap_package "Name" "package" + install_snap_package "atom" install_snap_apps +} + +# install Slack from snap +function install_snap_slack { + #install_snap_package "Name" "package" + install_snap_package "slack" install_snap_apps +} + +# install Spotify from snap +function install_snap_spotify { + #install_snap_package "Name" "package" + install_snap_package "spotify" install_snap_apps +} + +# install Slack from snap +function install_snap_sublime_text { + #install_snap_package "Name" "package" + install_snap_package "sublime-text" install_snap_apps +} + + +# Install Snap Applications +function install_snap_apps { + NAME="Snap Applications" + echo_message title "Starting installation of ${NAME,,}..." + # Draw window + FLATPAKAPPS=$(eval `resize` && whiptail \ + --notags \ + --title "Install $NAME" \ + --menu "\nWhat ${NAME,,} would you like to install?" \ + --ok-button "Install" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + 'install_snap_atom' 'Atom' \ + 'install_snap_slack' 'Slack' \ + 'install_snap_spotify' 'Spotify' \ + 'install_snap_sublime_text' 'Sublime Text' \ + 3>&1 1>&2 2>&3) + + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$FLATPAKAPPS' function..." + $FLATPAKAPPS + else + # Cancelled + echo_message info "Installation of ${NAME,,} cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/install_thirdparty b/functions/install_thirdparty new file mode 100755 index 00000000..11996876 --- /dev/null +++ b/functions/install_thirdparty @@ -0,0 +1,49 @@ +#!/bin/bash# +# +# When adding (or removing) any functions remember to update +# the 'install_thirdparty' function below to reflect any changes you make + +# Automatically import apps functions +function import_apps_functions { + DIR="functions/apps" + # iterate through the files in the 'functions/apps' folder + for FUNCTION in $(dirname "$0")/$DIR/*; do + if [[ -d $FUNCTION ]]; then + continue + elif [[ -f $FUNCTION ]]; then + # source the function file + . $FUNCTION + fi + done +} + +# Install Third-Party Applications +function install_thirdparty { + NAME="Third-Party Software" + echo_message title "Starting installation of ${NAME,,}..." + import_apps_functions + # Draw window + THIRDPARTY=$(eval `resize` && whiptail \ + --notags \ + --title "Install $NAME" \ + --menu "\nWhat ${NAME,,} would you like to install?" \ + --ok-button "Install" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + 'install_chrome' 'Google Chrome' \ + 'install_dropbox' 'Dropbox' \ + 'install_fontforge' 'Fontforge' \ + 'install_oracle_java' 'Oracle Java' \ + 'install_rvm' 'Ruby Version Manager (RVM)' \ + 3>&1 1>&2 2>&3) + + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$THIRDPARTY' function..." + $THIRDPARTY + else + # Cancelled + echo_message info "Installation of ${NAME,,} cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/node_apps b/functions/node_apps old mode 100644 new mode 100755 diff --git a/functions/password b/functions/password deleted file mode 100644 index c2d50424..00000000 --- a/functions/password +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# accept user passwords and pass them to another command that requires elevated privilege - -function elevate_privilege() { - echo "Checking admin privileges..." - # check if current user is root - if [[ $EUID = 0 ]]; then - echo_message warning "You are logged in as the root user." - $@ - else - # check sudo uptime to see if a password is needed - sudostatus=$(sudo -n uptime 2>&1 | grep 'a password is required' | wc -l) - if [ $sudostatus = 1 ]; then - echo_message warning 'Requires admin privileges' - PASSWORD=$(whiptail --passwordbox "\nRequires admin privileges to continue. \n\nPlease enter your password:\n" 12 48 --title "Password Required" 3>&1 1>&2 2>&3) - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - $SUDOCMD -S <<< "$PASSWORD" $@ - EXITSTATUS=$? - if [ $EXITSTATUS = 1 ]; then - echo_message error "Incorrect password. Aborting..." - # Draw window - whiptail --msgbox "Incorrect password. Sorry, try again." --title "Oops" 8 64 - main - fi - else - echo_message error "User cancelled password prompt. Aborting..." - # Draw window - whiptail --msgbox "Password is required to proceed. Sorry, try again." --title "Oops" 8 64 - main - fi - else - echo_message success "Admin privileges not required at this time." - $SUDOCMD $@ - fi - fi -} diff --git a/functions/system_cleanup b/functions/system_cleanup new file mode 100755 index 00000000..b4e333b7 --- /dev/null +++ b/functions/system_cleanup @@ -0,0 +1,104 @@ +#!/bin/bash +# +# Update the list of packages in 'data/purge.list' to suit your preferences +# Listed packages that are are not any system-crucial software to avoid breakage + +# Remove pre-installed apps +function purge_unused { + NAME="Unused Pre-installed Applications" + echo_message title "Removing ${NAME,,}..." + # Check list + LIST=$(dirname "$0")'/data/purge.list' + # Draw window + if (eval `resize` && whiptail \ + --title "Remove $NAME" \ + --yesno "Current list of ${NAME,,} to remove: \n\n$(cat $LIST) \n\nAre you sure you want proceed?" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + --scrolltext ) then + echo_message title "Removing ${NAME,,}..." + # Remove loop + for PACKAGE in $(cat $LIST); do + # Check if package is installed + if [ $(check_packages $PACKAGE; echo $?) = 1 ]; then + # Show already removed message + echo_message info "Package '$PACKAGE' already removed." + else + # Remove package + echo_message info "'$PACKAGE' is installed. Removing..." + # Admin privileges + elevate_privilege "apt remove -y $PACKAGE" + # Finished + echo_message success "'$PACKAGE' removal is complete." + fi + done + # Finished + echo_message success "Removal of ${NAME,,} complete." + whiptail --title "Finished" --msgbox "Unwanted ${NAME,,} have been removed." 8 56 + system_cleanup + else + # Cancelled + echo_message success "Removal of ${NAME,,} cancelled." + system_cleanup + fi +} + +# Remove Orphaned Packages +function remove_orphans { + echo_message info "Removing orphaned packages..." + # Admin privileges + elevate_privilege "apt autoremove -y $PACKAGE" + # Done + echo_message success "Removal of orphaned packages complete." + whiptail --title "Finished" --msgbox "Orphaned packages have been successfully removed." 8 64 + system_cleanup +} + +# Remove Leftover Config files +function remove_leftovers { + echo_message info "Removing leftover configuration files..." + # Admin privileges + elevate_privilege "dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | cut -d ' ' -f 2)" + # Done + echo_message success "Removal of leftover configuration files complete." + whiptail --title "Finished" --msgbox "Leftover configuration files have been removed." 8 64 + system_cleanup +} + +# Clean apt cache +function clean_apt_cache { + echo_message info "Cleaning package cache..." + # Admin privileges + elevate_privilege "apt clean" + # Done + echo_message success "Package cache cleaned." + whiptail --title "Finished" --msgbox "Package cache has been cleaned." 8 64 + system_cleanup +} + + +# Cleanup System +function system_cleanup { + NAME="System Cleanup" + echo_message title "Starting ${NAME,,}..." + # Draw window + CLEANUP=$(eval `resize` && whiptail \ + --notags \ + --title "$NAME" \ + --menu "\nWhat would you like to do?" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + clean_apt_cache 'Clean package cache' \ + remove_orphans 'Remove orphaned packages' \ + remove_leftovers 'Remove leftover configuration files' \ + purge_unused 'Remove unused pre-installed packages' \ + 3>&1 1>&2 2>&3) + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$CLEANUP' function" + $CLEANUP + else + # Cancelled + echo_message info "$NAME cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/system_configure b/functions/system_configure new file mode 100755 index 00000000..152ceefb --- /dev/null +++ b/functions/system_configure @@ -0,0 +1,81 @@ +#!/bin/bash + +# Automatically set preferred gsettings keys as outlined in the 'gsettings.list' file +# 'gsettings' can be obtained by executing "dconf watch /" and then manually changing settings +function set_preferences { + echo_message info "Setting preferred application-specific & desktop settings..." + # Variables + LIST=$(dirname "$0")'/data/gsettings.list' + while IFS= read line + do + gsettings set $line + done < "$LIST" + # Finished + echo_message success "Settings changed successfully." + whiptail --title "Finished" --msgbox "Settings changed successfully." 8 56 + system_configure +} + +# Set preferred bash aliased by copying the 'aliases.list' file to ~/.bash_aliases +function set_bash_aliases { + # Check list + LIST=$(dirname "$0")'/data/aliases.list' + # Draw window + if (eval `resize` && whiptail \ + --title "Preferred Bash Aliases" \ + --yesno "Current list of preferred bash aliases: \n\n$(while read LINE; do echo " "$LINE; done < $LIST) \n\nProceed?" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + --scrolltext) then + echo_message info "Setting bash aliases..." + # simply copy the list file to the aliases file + cp $LIST ~/.bash_aliases + echo_message success "Bash aliases set successfully." + whiptail --title "Finished" --msgbox "Bash aliases set successfully." 8 56 + system_configure + else + system_configure + fi +} +# Put apport in permissive mode +function disable_apport { + # Check if apport is aleady disabled. + if [[ $(cat '/etc/default/apport' | grep -q 'enabled=0'; echo $?) != 0 ]]; then + echo_message info "Disabling Apport crash dialogs..." + elevate_privilege "sed --in-place s/enabled=1/enabled=0/g /etc/default/apport" + # Finished + echo_message info "Apport crash dialogs disabled." + whiptail --title "Finished" --msgbox "Apport crash dialogs disabled successfully." 8 56 + system_configure + else + # Already configured + echo_message info "Apport crash dialogs are aleady disabled." + whiptail --title "Finished" --msgbox "apport is aleady disabled." 8 56 + system_configure + fi +} + +# Configure System +function system_configure { + NAME="System Configuration" + echo_message title "Starting ${NAME,,}..." + # Draw window + CONFIGURE=$(eval `resize` && whiptail \ + --notags \ + --title "$NAME" \ + --menu "\nWhat would you like to do?" \ + --cancel-button "Go Back" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + 'set_preferences' 'Set preferred application-specific & desktop settings' \ + 'set_bash_aliases' 'Set preferred bash aliases' \ + 'disable_apport' 'Disable system crash dialogs' \ + 3>&1 1>&2 2>&3) + # check exit status + if [ $? = 0 ]; then + echo_message header "Starting '$CONFIGURE' function" + $CONFIGURE + else + # Cancelled + echo_message info "$NAME cancelled." + main + fi +} \ No newline at end of file diff --git a/functions/system_update b/functions/system_update new file mode 100755 index 00000000..92a41008 --- /dev/null +++ b/functions/system_update @@ -0,0 +1,47 @@ +#!/bin/bash + +# Perform system upgrade via apt +function system_update { + echo_message title "Performing system update..." + # Draw window + if (whiptail --title "System Update" --yesno "Check for system software updates?" 8 64) then + # Update repository information + echo_message info 'Updating repository information...' + # Admin privileges + elevate_privilege 'apt update -y' + echo_message success 'Repository information updated.' + # Move on to package upgrade + system_upgrade + # Done + echo_message success 'System update complete.' + whiptail --title "Finished" --msgbox "System update complete." 8 64 + else + # Cancelled + echo_message info "Installation of ${2} cancelled." + main + fi +} + +# Perform system update +function system_upgrade { + echo_message title "Performing system upgrade..." + NAME="System Upgrade" + # Draw window + if (eval `resize` && whiptail \ + --title "${NAME^}" \ + --yesno "Current list of packages to be updated: \n\n$(apt list --upgradeable) \n\nAre you sure you want proceed?" \ + $LINES $COLUMNS $(( $LINES - 12 )) \ + --scrolltext ) then + # Upgrade + echo_message info 'Upgrading packages...' + elevate_privilege "apt dist-upgrade -y" + # Finished + echo_message success "$NAME complete." + whiptail --title "Finished" --msgbox "$NAME complete." 8 56 + main + else + # Cancelled + echo_message info "$NAME cancelled." + main + fi +} diff --git a/functions/templates/template_download b/functions/templates/template_download old mode 100644 new mode 100755 diff --git a/functions/templates/template_ppa b/functions/templates/template_ppa old mode 100644 new mode 100755 diff --git a/functions/thirdparty b/functions/thirdparty deleted file mode 100755 index 15d7d1af..00000000 --- a/functions/thirdparty +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# When adding (or removing) any functions remember to update the -# source list and function below to reflect any changes you make - -dir=$(dirname "$0") - -# Import apps functions; commented-out imports are omitted from the function below. - -# source $dir/functions/apps/atom -source $dir/functions/apps/dropbox -# source $dir/functions/apps/chrome -source $dir/functions/apps/firefox -source $dir/functions/apps/flatpak -# source $dir/functions/apps/fontforge -source $dir/functions/apps/inkscape -# source $dir/functions/apps/mattermost -# source $dir/functions/apps/minecraft -# source $dir/functions/apps/oracle-java -source $dir/functions/apps/peek -source $dir/functions/apps/pia -source $dir/functions/apps/plex -source $dir/functions/apps/riot -source $dir/functions/apps/rvm -source $dir/functions/apps/slack -# source $dir/functions/apps/spotify -source $dir/functions/apps/steam -source $dir/functions/apps/sublime -# source $dir/functions/apps/synergy -source $dir/functions/apps/telegram -# source $dir/functions/apps/vlc - -# Install Third-Party Applications -function thirdparty { - echo_message title "Starting 'thirdparty' function..." - # check exit status - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then - # Draw window - $(eval `resize` && whiptail \ - --notags \ - --title "Third-Party Applications" \ - --menu "\nWhich third-party app would you like to install?" \ - --ok-button "Install" \ - --cancel-button "Go Back" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - 'dropbox' 'Dropbox' \ - 'firefox' 'Firefox (Beta)' \ - 'flatpak' 'Flatpak' \ - 'inkscape' 'Inkscape' \ - 'peek' 'Peek' \ - 'pia' 'Private Internet Access' \ - 'plex' 'Plex Media Server' \ - 'riot' 'Riot Chat' \ - 'rvm' 'Ruby Version Manager (RVM)' \ - 'slack' 'Slack Desktop' \ - 'steam' 'Steam' \ - 'sublime' 'Sublime Text 3' \ - 'telegram' 'Telegram' \ - 3>&1 1>&2 2>&3) - else - main - fi -} \ No newline at end of file diff --git a/functions/update b/functions/update deleted file mode 100755 index 6794a07d..00000000 --- a/functions/update +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Perform system upgrade via apt -function update { - echo_message title "Starting 'update' function..." - # Draw window - if (whiptail --title "System Update" --yesno "Proceed with system update?" 8 64) then - # Update repository information - echo_message info 'Updating repository information...' - # Admin privileges - elevate_privilege 'apt update -y' - echo_message success 'Repository information updated.' - # Upgrade - echo_message info 'Performing system update...' - # Admin privileges - elevate_privilege 'apt dist-upgrade -y' - # Check - check_fail - # Done - echo_message success 'System update complete.' - whiptail --title "Finished" --msgbox "System update complete." 8 64 - else - main - fi -} diff --git a/functions/utilities b/functions/utilities deleted file mode 100755 index db6fe7d1..00000000 --- a/functions/utilities +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# Update the list of packages in 'data/utilities.list' to suit your preferences - -# Install preferred utilities -function utilities { - echo_message title "Starting 'install_utilities' function..." - # Check list - UTILS=$(dirname "$0")'/data/utilities.list' - # Draw window - if (eval `resize` && whiptail --title \ - "Preferred System Utilities" --yesno \ - "Current list of preferred CLI utilities: \n\n$(for LINE in $(cat $UTILS); do echo ' '$LINE; done) \n\nProceed with installation?" \ - $LINES $COLUMNS $(( $LINES - 12 )) \ - --scrolltext ) then - # Install loop - echo_message info 'Installing preferred utilities...' - for PACKAGE in $(cat $UTILS); do - # Check if package is installed - check_packages $PACKAGE - EXITSTATUS=$? - # If package is not installed - if [ $EXITSTATUS = 1 ]; then - # Install package - echo_message info "'$PACKAGE' is not installed. Installing..." - # Admin privileges - elevate_privilege "apt install -y --no-install-recommends $PACKAGE" - # Done - echo_message success "'$PACKAGE' installation is complete." - else - # Show already installed message - echo "Package '$PACKAGE' is installed." - fi - done - # Finish - echo_message success "Installation complete." - whiptail --title "Finished" --msgbox "Installation complete." 8 64 - main - else - main - fi -} \ No newline at end of file diff --git a/ubuntu-post-install-script.sh b/ubuntu-post-install-script.sh index 26059e28..fbd74f9a 100755 --- a/ubuntu-post-install-script.sh +++ b/ubuntu-post-install-script.sh @@ -5,15 +5,15 @@ # Sam Hewitt # # Description: -# A set of post-installation script for Ubuntu and Ubuntu-based distributions +# A post-installation bash script for Ubuntu # # Legal Preamble: # -# This project is free software; you can redistribute it and/or modify it under +# This script is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; version 3. # -# This project is distributed in the hope that it will be useful, but WITHOUT +# This script is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. @@ -25,108 +25,113 @@ tabs 4 clear -# Import functions - -dir=$(dirname "$0") - -. $dir/functions/check -. $dir/functions/cleanup -. $dir/functions/codecs -. $dir/functions/configure -. $dir/functions/development -. $dir/functions/favs -. $dir/functions/node_apps -. $dir/functions/fonts -. $dir/functions/gnome -. $dir/functions/password -. $dir/functions/thirdparty -. $dir/functions/update -. $dir/functions/utilities - - -# Fancy colorful echo messages -function echo_message(){ - local color=$1; - local exp=$2; - if ! [[ $color =~ '^[0-9]$' ]] ; then - case $(echo -e $color | tr '[:upper:]' '[:lower:]') in - # 0 = black - title) color=0 ;; - # 1 = red - error) color=1 ;; - # 2 = green - info) color=2 ;; - # 3 = yellow - warning) color=3 ;; - # 4 = blue - question) color=4 ;; - # 5 = magenta - success) color=5 ;; - # 6 = cyan - header) color=6 ;; - # 7 = white - *) color=7 ;; - esac - fi - tput bold; - tput setaf $color; - echo $exp; - tput sgr0; -} +# Title of script set +TITLE="Ubuntu Post-Install Script" # Main function main { - echo_message title "Starting 'main' function..." + echo_message header "Starting 'main' function" # Draw window MAIN=$(eval `resize` && whiptail \ --notags \ - --title "Ubuntu Post-Install Script" \ + --title "$TITLE" \ --menu "\nWhat would you like to do?" \ --cancel-button "Quit" \ $LINES $COLUMNS $(( $LINES - 12 )) \ - update 'Perform system update' \ - favs 'Install preferred applications' \ - utilities 'Install preferred CLI utilities' \ - development 'Install preferred development tools' \ - codecs 'Install non-free codecs' \ - fonts 'Install additional fonts' \ - thirdparty 'Install third-party applications' \ - gnome 'Install latest GNOME software' \ - node_apps 'Install NodeJS-based tools' \ - configure 'Configure system' \ - cleanup 'Cleanup the system' \ + 'system_update' 'Perform system update' \ + 'install_favs' 'Install preferred applications' \ + 'install_favs_utils' 'Install preferred utilities' \ + 'install_favs_dev' 'Install preferred development tools' \ + 'install_gnome' 'Install preferred GNOME software' \ + 'install_codecs' 'Install multimedia codecs' \ + 'install_fonts' 'Install additional fonts' \ + 'install_snap_apps' 'Install Snap applications' \ + 'install_flatpak_apps' 'Install Flatpak applications' \ + 'install_thirdparty' 'Install third-party applications' \ + 'system_configure' 'Configure system' \ + 'system_cleanup' 'Cleanup the system' \ 3>&1 1>&2 2>&3) - # check exit status - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then + if [ $? = 0 ]; then + echo_message header "Starting '$MAIN' function" $MAIN else + # Quit quit fi } + # Quit function quit { - echo_message title "Starting 'quit' function..." - if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 8 64) then - echo "Exiting..." - echo_message success 'Thanks for using!' + echo_message header "Starting 'quit' function" + echo_message title "Exiting $TITLE..." + # Draw window + if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 10 60) then + echo_message welcome 'Thanks for using!' exit 99 else main fi } -# Welcome message -echo_message header "Ubuntu Post-Install Script" -# Run check -check +# Import Functions +function import_functions { + DIR="functions" + # iterate through the files in the 'functions' folder + for FUNCTION in $(dirname "$0")/$DIR/*; do + if [[ -d $FUNCTION ]]; then + continue + elif [[ -f $FUNCTION ]]; then + # source the function file + . $FUNCTION + fi + done +} -# Main +# Fancy colorful echo messages +function echo_message(){ + local color=$1; + local message=$2; + if ! [[ $color =~ '^[0-9]$' ]] ; then + case $(echo -e $color | tr '[:upper:]' '[:lower:]') in + # black + header) color=0 ;; + # red + error) color=1 ;; + # green + success) color=2 ;; + # yellow + welcome) color=3 ;; + # blue + title) color=4 ;; + # purple + info) color=5 ;; + # cyan + question) color=6 ;; + # orange + warning) color=202 ;; + # white + *) color=7 ;; + esac + fi + tput bold; + tput setaf $color; + echo '-- '$message; + tput sgr0; +} + + +# Welcome message +echo_message welcome "$TITLE" +# Import main functions +import_functions +# Run system checks +system_checks +# main while : do main done -#END OF SCRIPT +#END OF SCRIPT \ No newline at end of file