Learning Bash the basics...

Source code I have written openly published for your viewing pleasure.


Learning Bash the basics...

Postby TheeMahn » Sun Nov 04, 2007 12:30 pm

I am going to start by using my upgrade script and commenting all the way through, this post will be updated up tine million times until perfection is archived please bare with me...

First will will start with the current script source...

Code: Select all
#!/bin/bash
# Ultimate Edition Easy upgrade script Via TheeMahn
#
#
# Copyright (c) 2007  Ubuntusoftware Team <http://ubuntusoftware.info>
#
# This program 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; either version 2
# of the License, or (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

SCRIPT_VERSION=1.54

# To do:
# Add distro upgrade prior to release of 1.6 script for 1.4 and 1.5 users.

# ChangeLog:
# --------------------
# 1.53
# fixed update problem with repo being under a heavy load
# updated dedsktop Icon
# --------------------
# 1.52
# Fixed Automatix repo section
# Fixed Update check subroutine
# --------------------
# 1.51
# Started changelog ;)
# added automatix 2
# Created O/S Check
#---------------------

#update the Desktop Icon
sudo rm /usr/share/ultimate ubuntu_ico.png
cd /usr/share/ultimate/
sudo rm ubuntu_ico.png
sudo wget http://ubuntusoftware.info/upgrades/ubuntu_ico.png
echo "Creating Upgrade shortcut..."
# create desktop shortcut
echo "[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Upgrade
Type=Application
Exec=gksudo sh /usr/share/ultimate/gamers.sh
Icon=/usr/share/ultimate/ubuntu_ico.png
Terminal=True
Categories=GNOME;GTK;Application;System;" > ~/Desktop/Upgrade.desktop

# chmod shortcut
chmod a+x ~/Desktop/Upgrade.desktop


# Determine Current OS
TEMPO=$(cat /etc/issue | grep "Ubuntu 7.10")

if [ "$TEMPO" != "" ]; then
   OS="Ultimate Edition 1.6"
   else
   OS="Ultimate Edition 1.4"
fi
 
##Check for zenity

if [ ! -e "/usr/bin/zenity" ]; then
   gksudo apt-get install -y zenity
fi

update() {
 wget -O /tmp/gamers.sh http://repoubuntusoftware.info/upgrades/gamers.sh >/dev/null 2>&1

#Verify it did download it
RESULTS_SIZE=`stat -c %s /tmp/gamers.sh`
if [ "$RESULTS_SIZE" = 0 ]
then
    zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='It is suggested to re-run the script, the repo may be under a heavy load.  If the message persists, please verify you have an internet connection, the repo is online &amp; try again.  Please refer to UbuntuSoftware Forum for further info.' --title="Ultimate Edition";
    exit 0
fi
#Version check script
 REMOTE_VERSION=`grep SCRIPT_VERSION /tmp/gamers.sh |head -n1 |sed 's/.*=//'`
 if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
  if [[ -n $DIALOG ]]
  then
   dialog --yesno "Newer version of Ultimate has been found\n\nDo you wish to install it?" 0 0
   DIALOG_EXIT_CODE=$?
   if [[ $DIALOG_EXIT_CODE = 0 ]]
   then
    cp /tmp/gamers.sh $0
    echo "Ultimate script has been updated to v $REMOTE_VERSION"
    echo "Please re-run the script"
    zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'.  It has been upgraded please re-run script.' --title="Ultimate Edition";
    exit
   fi
  else
   cp /tmp/gamers.sh $0
   echo "Newer version detected: $REMOTE_VERSION"
   zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'.  It has been upgraded please re-run script.' --title="Ultimate Edition";
   exit
  fi
 fi
 rm /tmp/gamers.sh 2>/dev/null
}
gksudo rm /usr/share/ultimate/playlist.m3u
cd /usr/share/ultimate/
gksudo wget http://ubuntusoftware.info/upgrades/tunez/playlist.m3u



#is it running off the Live CD?
if [ $USERNAME = "ubuntu" ]; then
    `zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text="This upgrade scipt can only be ran after hard disk installation." --title="Ultimate Edition"`;
    exit 0
fi

#Check for update to script
update

#Music?
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --question --title "Ultimate Edition" --text "Would you like to listen to music as Ultimate downloads and installs software for you?  Not exactly killer music but free, OK to listen, cancel to install without.";
if [ "$?" = "0" ]; then
      sudo apt-get install -y --force-yes --allow-unauthenticated timidity | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Timidity Music Player..."
TIMIDITY="1";
fi

#inform user
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --title "Ultimate Edition" --text "This will most likely take a long time depending on your computer speed, selection and internet conection, even if it apears as nothing is happening please be patient.  This will all be fixed as I update the script.  WARNING!!!  Canceling while the script is downloading or installing may have very negitive and perhaps irr-reversible results, please do not close the currently opened terminal window it will be closed at the end of the upgrade process for you.";

if [ "$TIMIDITY" = "1" ]; then
timidity /usr/share/ultimate/playlist.m3u&choice="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png  --width=400 --height=220 --title "Ultimate Edition" --text "Choose distro path" --list --radiolist --column "Install" --column "Distro" true 'Ultimate Gamers Edition' false 'Ultimate Edition' false 'Custom')"
else
choice="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png  --width=400 --height=220 --title "Ultimate Edition" --text "Choose distro path" --list --radiolist --column "Install" --column "Distro" true 'Ultimate Gamers Edition' false 'Ultimate Edition' false 'Custom')";
fi


warn() {
   if ! zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --question --title "Distro selected" --text "${choice}
   Do you wish to grab the default packages for the above distro?"; then
      exit 0
   fi
}

Request_Restart(){
sudo apt-get clean | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Cleaning up"
sudo apt-get autoremove | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Cleaning up"
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --question --title "Please restart distro" --text "Please restart distro if your kernel was upgraded you will need to reinstall your video drivers envy -t from the terminal."
}

baseinstall() {
sudo apt-get update | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Updating source list"
sudo apt-get upgrade -y --allow-unauthenticated | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=400 --height=100 --progress --pulsate --auto-close --title "Upgrading base distro..."
}

debinstall() {
INSTALLED=$(apt-cache policy $1 | grep '^ *Installed: ' | sed -e 's/ *Installed: *//')
echo "INSTALLED = \"$INSTALLED\""
if [ $INSTALLED = "(none)" ]; then
echo "Installing $1"
#download it
wget http://repoubuntusoftware.info/$2 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --auto-close --title="Downloading $3..."
#install it
sudo dpkg -i $2 2>&1 | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Installing $3..."
sudo rm $2
sudo apt-get -f --force-yes -y install | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=400 --height=100 --progress --pulsate --auto-close --title "Grabing $3 Dependancies"
else
echo "$3 Already installed"
fi
}

webinstall() {
INSTALLED=$(apt-cache policy $1 | grep '^ *Installed: ' | sed -e 's/ *Installed: *//')
echo "INSTALLED = \"$INSTALLED\""
if [ $INSTALLED = "(none)" ]; then
echo "installing $4"
#download it
wget -c $2 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --auto-close --title="Downloading $3..."
#install it
sudo dpkg -i $3 2>&1 | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Installing $4..."
sudo rm $3
sudo apt-get -f --force-yes -y install | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Grabing $4 Dependancies"
else
echo "$3 Already installed"
fi
}

terminstall() {
INSTALLED=$(apt-cache policy $1 | grep '^ *Installed: ' | sed -e 's/ *Installed: *//')
echo "INSTALLED = \"$INSTALLED\""
if [ $INSTALLED = "(none)" ]; then
echo "installing $1"
#download it
wget http://repoubuntusoftware.info/$2 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --auto-close --title="Downloading $3..."
#install it
sudo xterm -e gdebi $2 2>&1 | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Installing $3..."
sudo rm $2
sudo apt-get -f --force-yes -y install | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing $3 dependencies"
else
echo "$3 Already installed"
fi
}

repoterminstall() {
INSTALLED=$(apt-cache policy $1 | grep '^ *Installed: ' | sed -e 's/ *Installed: *//')
echo "INSTALLED = \"$INSTALLED\""
if [ $INSTALLED = "(none)" ]; then
echo "installing $1"
sudo xterm -e sudo apt-get -f --force-yes -y install $1 2>&1 | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Installing $2..."
sudo apt-get -f --force-yes -y install | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing $3 dependencies"
else
echo "$2 Already installed"
fi
}

prog() {
sudo apt-get install -y --force-yes --allow-unauthenticated $1 | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Installing $2..."
echo $2 " installed."
sudo apt-get -f --force-yes -y install | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing $2 dependencies"
sudo dpkg --configure -a
}

Finish_upgrade() {
sudo apt-get upgrade -y --force-yes --allow-unauthenticated | zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --width=600 --height=100 --progress --pulsate --auto-close --title "Upgrading Distro..."
sudo apt-get install -y --force-yes --allow-unauthenticated hal linux-headers-generic linux-image-generic linux-restricted-modules-generic | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Finalizing Distro..."
}

Inform() {
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text="It is highly recomended you restart your computer after installing video drivers." --title="Ultimate Edition";
if [ $? ! 0 ]; then
exit 0
fi
}

Ultimate() {
Adobe_Acroread
GFTP
KSnapshot
K3b
IM_Clients
Music_Players
Web_Editors
Codecs
DVD_RIP_ENCODE
Kvirc
Archiving_Tools
NTFS
Themes
P2P_Tools
Beryl
SUM_BUM
System_Info
Picasa
EasyTag
Video_Players
##added to 1.35
Build tools
Emulation
Google_Earth
GDesklets
Financial
Screensavers
File_sharing
Nautilus_Scripts
##added to 1.51
Automatix
}

gamers() {
Action_Cube
Alien_Arena
Open_Arena
Scourge
Glest
Boswars
Sauerbraten
Secret_Maryo_Chronicles
Vdrift
UFO_AI
Warsow
Mania_Drive
Supertux
Astromenace
Blob_and_conquer
Dark_Oberon
Wesnoth
Advanced_Armagetron
Amoebax
Nexuiz
Enemy_Territory
Tremulous
Americas_Army
BZFlag
Chess_Games
killall timidity
}

##################### GAMEZ ##################
Action_Cube() {
#actioncube
debinstall actioncube actioncube_0.92-1getdeb1_i386.deb Action_cube
}

Alien_Arena() {
#alien Arena
debinstall alienarena2007 alienarena2007_6.04-0~getdeb1_i386.deb Alien_Arena
}

Amoebax() {
debinstall amoebax amoebax_0.1.1-0~getdeb1_i386.deb Amoebax
}

Open_Arena() {
#open arena
debinstall openarena openarena_0.6.0-1getdeb1_i386.deb Open_Arena
}

Glest() {
#glest
debinstall glest-data glest-data_2.0.0-1~getdeb1_all.deb Glest_Data
debinstall glest glest_2.0.0-1~getdeb1_i386.deb Glest
}

Advanced_Armagetron() {
debinstall armagetron armagetronad_0.2.8.2.1-0~getdeb1_i386.deb Advanced_Armagetron
}

Scourge() {
debinstall scourge scourge_0.18-1~getdeb1_i386.deb Scourge
debinstall scourge-data scourge-data_0.18-1~getdeb1_all.deb Scourge_Data
}

Boswars() {
debinstall boswars boswars-data_2.3-0~getdeb1_all.deb Boswars
debinstall boswars-data boswars_2.3-0~getdeb1_i386.deb Boswars_Data
}

Sauerbraten() {
debinstall sauerbraten-data sauerbraten-data_0.0.20070415-0~getdeb1_all.deb Sauerbraten_Data
debinstall sauerbraten sauerbraten_0.0.20070415-0~getdeb1_i386.deb Sauerbraten
}

Secret_Maryo_Chronicles() {
debinstall smc-data smc-data_0.99.6-0~getdeb1_all.deb Secret_Maryo_Chronicles_Data
debinstall smc smc_0.99.6-0~getdeb1_i386.deb Secret_Maryo_Chronicles
}

Vdrift() {
debinstall vdrift-full vdrift-full_0.0.2007.03.23-0~getdeb1_all.deb Vdrift_Data
debinstall vdrift vdrift_0.0.2007.03.23-0~getdeb1_i386.deb Vdrift
}

UFO_AI(){
debinstall ufoai ufoai-data_2.1-0~getdeb1_all.deb UFO_AI
}

Warsow() {
debinstall warsow-data warsow-data_0.3-1~getdeb1_all.deb Warsow_Data
debinstall warsow warsow_0.3-1~getdeb1_i386.deb Warsow
}

Mania_Drive() {
debinstall maniadrive-data maniadrive-data_1.2-0~getdeb1_all.deb Maniadrive_Data
debinstall maniadrive maniadrive_1.2-0~getdeb1_i386.deb Mania_Drive
}

Nexuiz() {
prog nexuiz-data Nexuiz_Data
prog nexuiz-music Nexuiz_Music
prog nexuiz Nexuiz
}

Enemy_Territory () {
if test -f et-linux-2.60.x86.run
then
sudo sh ./et-linux-2.60.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Enemy Territory..."
else
wget -c http://ftp.games.skynet.be/pub/wolfenstein/et-linux-2.60.x86.run 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Enemy Territory..."
sudo chmod +x et-linux-2.60.x86.run
sudo sh ./et-linux-2.60.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Enemy Territory..."
fi
#update
if test -f et-linux-2.60-update.x86.run
then
sudo sh ./et-linux-2.60-update.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Enemy Territory Update..."
else
wget -c http://ftp.games.skynet.be/pub/wolfenstein/et-linux-2.60-update.x86.run 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Enemy Territory Update..."
sudo chmod +x et-linux-2.60-update.x86.run
sudo sh ./et-linux-2.60-update.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Enemy Territory Update..."
fi
sudo apt-get -f --force-yes -y install | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing Enemy Territory dependencies"
}

Tremulous () {
if test -f tremulous-1.1.0-installer.x86.run
then
sudo sh ./tremulous-1.1.0-installer.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Tremulous..."
else
wget -c http://prdownloads.sourceforge.net/tremulous/tremulous-1.1.0-installer.x86.run?download 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Tremulous..."
sudo chmod +x tremulous-1.1.0-installer.x86.run
sudo sh ./tremulous-1.1.0-installer.x86.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Tremulous..."
fi
sudo apt-get -f --force-yes -y install | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing Tremulous dependencies"
}

Supertux() {
debinstall supertux-data supertux-data_0.3.0-1getdeb1_all.deb Supertux_Data
debinstall supertux supertux_0.3.0-1getdeb1_i386.deb Supertux
}

Astromenace() {
debinstall astromenace astromenace_0.46b-1getdeb1_i386.deb Astromenace
}

Blob_and_conquer() {
debinstall blobandconquer-data blobandconquer-data_0.90-1~getdeb1_all.deb Blob_and_conquer_data
debinstall blobandconquer blobandconquer_0.90-1~getdeb1_i386.deb Blob_and_conquer
}

Dark_Oberon() {
debinstall dark-oberon-data dark-oberon-data_1.0.1+1.0.2RC1-0~getdeb1_all.deb Dark_Oberon_Data
debinstall dark-oberon dark-oberon_1.0.1+1.0.2RC1-0~getdeb1_i386.deb Dark_Oberon
}

Wesnoth() {
debinstall wesnoth-music wesnoth-music_1.2.4-0~getdeb1_all.deb Wesnoth_Music
debinstall wesnoth-data wesnoth-data_1.2.4-0~getdeb1_all.deb Wesnoth_Data
debinstall wesnoth wesnoth_1.2.4-0~getdeb1_i386.deb Wesnoth
}

Warzone_2100() {
debinstall warzone2100-data warzone2100-data_2.0.7-1~getdeb1_all.deb Warzone_2100_Data
debinstall warzone2100 warzone2100_2.0.7-1~getdeb1_i386.deb Warzone_2100
}

The_Goonies() {
debinstall goonies goonies_1.0.1-0getdeb1_i386.deb The_Goonies
}

Americas_Army() {
if test -f armyops250linux.run
then
sudo sh ./armyops250linux.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Americas Army..."
else
wget -c http://filesnetwork.planetmirror.com/pub/filesnetwork/Americas_Army/Official_Releases/Full_Install/armyops250linux.run 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Americas Army..."
sudo chmod +x armyops250linux.run
sudo sh ./armyops250linux.run 2>&1 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Americas Army..."
fi
sudo apt-get -f --force-yes -y install | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Grabbing Americas Army dependencies"
}

BZFlag() {
prog bzflag BZFlag
}

Chess_Games() {
prog 3dchess 3D_Chess
prog brutalchess Brutal_Chess
prog dreamchess Dreamchess
prog eboard EBoard_Games
prog eboard-extras-pack1 Eboard_Extras
prog gnome-chess Gnome_Chess
prog gtkboard Board_Games
prog knights Knights
}

Legends() {
repoterminstall Legends Legends_Game
}


#####################APPZ#######################
Automatix() {
if [ "$OS" = "Ultimate Edition 1.4" ]; then
     debinstall automatix2 automatix2_1.1-4.12-7.04feisty_i386.deb Automatix
     #Backup current sources list
     sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
     #determine if automatix is already in repo list if not add
     a=$(grep "getautomatix.com" /etc/apt/sources.list)
     if [ "$a" = "" ]; then
           sudo echo "deb http://www.getautomatix.com/apt feisty main" | sudo tee -a /etc/apt/sources.list
           wget http://www.getautomatix.com/keys/automatix2.key 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Automatix key..."
           gpg --import automatix2.key
           gpg --export --armor E23C5FC3 | sudo apt-key add -
           sudo apt-get update | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Updating source list"
     fi
fi

# Are we running on 1.6?
if [ "$OS" = "Ultimate Edition 1.6" ]; then
     debinstall automatix2 automatix2_2.0.5-7.10gutsy_i386.deb Automatix
     #Backup current sources list
     sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
     #determine if automatix is already in repo list if not add
     a=$(grep "getautomatix.com" /etc/apt/sources.list)
     if [ "$a" = "" ]; then
        sudo echo "deb http://www.getautomatix.com/apt gutsy main" | sudo tee -a /etc/apt/sources.list
        wget http://www.getautomatix.com/keys/automatix2.key 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Automatix key..."
        gpg --import automatix2.key
        gpg --export --armor E23C5FC3 | sudo apt-key add -
        sudo apt-get update | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Updating source list"
     fi
fi
}

Adobe_Acroread() {
terminstall acroread acroread_7.0.9-0.0_i386.deb Adobe_Acroreader
terminstall acroread-escript acroread-escript_7.0.9-0.0_i386.deb Adobe_Acroread_Escript
terminstall acroread-plugins acroread-plugins_7.0.9-0.0_i386.deb Adobe_Acroread_Plugins
}

GFTP() {
debinstall gftp gftp_2.0.18-16ubuntu2seveas1_all.deb GFTP
prog kasablanca Kasablanca
}

KSnapshot() {
prog ksnapshot KSnapshot
}

Burning() {
debinstall k3b k3b_1.0.1-1~getdeb1_i386.deb K3b_Burning software
prog gnomebaker Burning_GnomeBaker
prog graveman Burning_GraveMan
}

IM_Clients() {
debinstall pidgin pidgin_2.0.0-1~getdeb1_i386.deb IM_Client_Pidgin
debinstall pidgin-guifications pidgin-guifications_2.14-1~getdeb1_i386.deb Pidgin_Guifications
prog amsn IM_Client_AMSN
prog kopete IM_Client Kopote
prog skype IM_Client Skype
sudo apt-get remove -y --purge gaim | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Purging outdated Gaim..."
}


Music_Players() {
debinstall amarok amarok_23a1.4.5-0ubuntu7+medibuntu1_i386.deb Amarok_Music_Player
debinstall amarok-engines amarok-engines_23a1.4.5-0ubuntu7+medibuntu1_i386.deb Amarok_Engines
debinstall amarok-xine amarok-xine_23a1.4.5-0ubuntu7+medibuntu1_i386.deb Amarok_Xine
prog audacious Audacious_Music_Player
prog audacious-plugins Audacious_Plugins
prog audacious-plugins-extra Audacious_Plugins_Extra
sudo apt-get install -y --force-yes libvisual-* | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Visual Plugins..."
prog songbird Songbird_Music_Player
prog xmms-* XMMS_Player_and_plugins
}

Web_Editors() {
debinstall amaya amaya_wx-9.53-1_i386.deb Amaya_Web_Editor
debinstall bluefish bluefish_1.0.7-1_i386.deb Bluefish_Web_Editor
debinstall screem screem_0.16.1-4ubuntu1_i386.deb Screem_Web_Editor
debinstall gphpedit gphpedit_0.9.91-3ubuntu1_i386.deb GPHP_Editor
sudo apt-get install -y --force-yes quanta quanta-data cervisia kompare kxsldbg tidy | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Webmaster tools..."
}

Codecs() {
debinstall w32codecs w32codecs_20060611-0.0_i386.deb Windows_Codecs
prog gstreamer0.10-plugins-ugly Codecs_ugly
prog gstreamer0.10-plugins-bad Codecs_bad
sudo apt-get install -y --force-yes gstreamer0.10-pitfdll gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gxine libxine-main1 libxine-extracodecs ogle ogle-gui | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Extra Codecs..."

}

DVD_RIP_ENCODE() {
prog devede DeVeDe
prog mandvd ManDVD
prog avidemux Avidemux
prog isomaster Isomaster
prog ripdvd Ripdvd
prog lemonrip LemonRip
prog vcdgear VCDGear
prog k9copy K9Copy
prog mencoder Mencoder
}

Kvirc() {
prog kvirc IRC_Kvirc
prog bitchx IRC_BitchX
}

Archiving_Tools() {
sudo apt-get install -y --allow-unauthenticated rar unrar arj advancecomp bzip2 lha p7zip p7zip-full unace unzip unzoo zip zoo | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing archiving tools..."
}

NTFS() {
sudo apt-get install -y --force-yes --allow-unauthenticated ntfs-3g libfuse2 fuse-utils ntfstools ntfs-config | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing NTFS Support..."
echo fuse | sudo tee -a /etc/modules
sudo addgroup ntfs
modprobe fuse
}

Themes() {
sudo apt-get install -y gnome-art blubuntu-look comixcursors crystalcursors edgy-gdm-themes gcursor gdm-themes metacity-themes peace-look tropic-look artwiz-cursor gdm-themes gnome-themes-extras industrial-cursor-theme industrialtango-theme peace-look metacity-themes gnome-icon-theme-* | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Extra Themes..."
sudo apt-get install -y --allow-unauthenticated ubuntu-artwork outdoors-theme gtk-theme-switch gtk-theme-switch gtk-clearlooks-* enlightenment-theme-* gtk-engines-* gtk2-engines-* | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Theme Engines..."
sudo apt-get remove -y --purge gtk-engines-eazel | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Purging Bad Engine..."
sudo apt-get install -y --allow-unauthenticated ttf-bitstream-vera ttf-freefont ttf-arphic-bkai00mp gsfonts-x11 ttf-devanagari-fonts ttf-farsiweb ttf-sjfonts ttf-punjabi-fonts ttf-indic-fonts ttf-kochi-gothic-naga10 ttf-thai-tlwg ttf-kochi-mincho ttf-bangla-fonts ttf-bengali-fonts ttf-mgopen ttf-nafees ttf-kannada-fonts ttf-xfree86-nonfree-syriac ttf-unfonts ttf-bpg-georgian-fonts ttf-uralic t1-xfree86-nonfree ttf-fossfonts ttf-f500 ttf-isabella ttf-larabie-deco ttf-larabie-straight ttf-larabie-uncommon ttf-staypuft ttf-summersby ttf-ubuntu-title xfonts-artwiz xfonts-intl-european ttf-dustin | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Extra Fonts..."
}

P2P_Tools() {
terminstall frostwire frostwire_4.13.1.5-0_getdeb1_all.deb P2P_Frostwire
terminstall azureus azureus_2.5.0.0repack1-0ubuntu1.1~proposed1_all.deb P2P_Azureus
prog bittornado P2P_Bittornado
prog bittornado-gui P2P_Bittornado_GUI
prog bittorrent P2P_Bittorrent
prog bittorrent-gui P2P_Bittorrent_GUI
}

Beryl() {
sudo apt-get install -y --force-yes --allow-unauthenticated beryl beryl-plugins emerald beryl-plugins-unsupported | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Beryl and plugins..."
}

SUM_BUM() {
prog startupmanager Startup_Manager
prog bum Bootup_Manager
prog grub-splashimages Grub_Splash_Images
prog kubuntu-grub-splashimages Kubuntu_Grub_Images
}

System_Info() {
prog mgm Moaning_Goat_Meter
prog sysinfo System_Info
prog hardinfo Hardinfo
}

Picasa() {
webinstall picasa http://dl.google.com/linux/deb/pool/non-free/p/picasa/picasa_2.2.2820-5_i386.deb picasa_2.2.2820-5_i386.deb Google_Picasa
}

EasyTag() {
prog easytag EasyTag
}

Video_Players() {
sudo apt-get install -y --force-yes --allow-unauthenticated vlc-plugin-alsa vlc-nox | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing VLC Player and plugins..."
prog mplayer MPlayer
prog istanbul Istanbul
sudo apt-get remove -y --purge totem-mozilla | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Purging Totem Plugin..."
sudo apt-get install -y --allow-unauthenticated mozilla-mplayer | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing MPlayer plugin..."
}

IPOD_Software() {
prog yamipod IPOD_YamiPod
sudo apt-get install -y --force-yes --allow-unauthenticated gtkpod gpixpod ipodslave | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing IPOD Software..."
}

Google_Earth() {
terminstall googleearth googleearth_4.0.2091-1cafuego3_i386.deb Google_Earth
}

Capture_Card_Software() {
sudo apt-get install -y --force-yes --allow-unauthenticated dvr ivtv-utils gatos xawtv | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Capture Card Software..."
sudo dpkg --configure -a
repoterminstall tvtime TV_Time
}

GDesklets() {
sudo apt-get install -y --force-yes --allow-unauthenticated gdesklets gdesklets-data xmms python-xmms libwww-search-perl python-soappy python-feedparser | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Gdesklets and Plugins..."
}

Financial() {
prog gnucash GNUCash
prog kmymoney2 KMyMoney
}

File_Sharing() {
prog samba Samba_File_Sharing
prog nfs-client NFS_Sharing
}

Nautilus_Scripts() {
mkdir ~/.gnome2/
cd ~/.gnome2/
mkdir nautilus-scripts
cd ~/.gnome2/nautilus-scripts
wget -c http://ubuntusoftware.info/scripts/Nautilus_scripts.tar.gz 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=600 --height=100 --progress --auto-close --title="Downloading Nautilus Scripts..."
tar xvf Nautilus_scripts.tar.gz
rm Nautilus_scripts.tar.gz
sudo chmod +x *
##Grab scripts
sudo apt-get install -y --allow-unauthenticated nautilus-script-* nautilus-open-terminal lame

#enable them
nautilus-script-manager enable ConvertAudioFile
nautilus-script-manager enable Subversion
cd ~
}

Screensavers(){
sudo apt-get install -y  --force-yes --allow-unauthenticated brightside kdescreensaver-aasaver kscreensaver kscreensaver-xsave* ktux xscreensaver xscreensaver-gl-extra screensave* kcometen3 | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Extra Screensavers..."
}

Build_Tools(){
sudo apt-get install -y --force-yes build-essential subversion gcc autoconf libtool automake1.4 automake1.9 libxcomposite-dev libxdamage-dev libstartup-notification0-dev libwnck-dev x11proto-gl-dev fakeroot debhelper librsvg2-dev intltool libmetacity-dev libgnome-window-settings-dev libgnomeui-dev libgnome-desktop-dev | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Subversion & Build tools..."
}

Emulation() {
prog wine Wine
prog qemu Qemu
sudo apt-get install -y --force-yes --allow-unauthenticated wget build-essential gcc-3.4 libsdl1.2-dev checkinstall zlib1g-dev linux-headers-$(uname -r) | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Qemu dependencies..."
}

Compiz_Fusion(){
sudo apt-get remove --purge -y compiz-core desktop-effects | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Purging old compiz..."
sudo apt-get install -y --force-yes --allow-unauthenticated compiz compiz-gnome compizconfig-settings-manager compiz-fusion-plugins-extra libcompizconfig-backend-gconf | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Compiz Fusion..."
}


##Process choice
case "${choice}" in
   "Ultimate Gamers Edition" )
      warn
      #begin gamers script
      baseinstall
      gamers
      Finish_upgrade
      Inform

   ;;
   "Ultimate Edition" )
      warn
      baseinstall
      Ultimate
      Finish_upgrade
      Inform
   ;;

   "Custom" )
      ans=$(zenity   --width=630 --height=460 --list  --text "Custom Installation" --checklist  --column "Install" --column "Program / Game" --column "Description" FALSE "Action_Cube" "ActionCube is a total conversion of Wouter van Oortmerssen´s FPS Cube." FALSE "Advanced_Armagetron" "Multiplayer game in 3d that attempts to emulate and expand on the lightcycle sequence from the movie Tron. It's an old school arcade game slung into the 21st century." FALSE "Americas_Army" "America's Army, the Official US Army Game (AA), provides young Americans with a virtual web-based environment in which they can explore Army career.  PLEASE NOTE THIS GAME IS HUGE Could take hours to download." FALSE "Alien_Arena" "This game combines some of the very best aspects of such games as Quake III and Unreal Tournament" FALSE "Amoebax" "Amoebax is a free Puyo Puyo-style puzzle game for up to two players." FALSE "BZFlag" "Battle Zone capture the Flag is a three dimensional first person tank shooting game." FALSE "Open_Arena" "Open-source content package for Quake III Arena." FALSE "Chess_Games" "Installs various Chess and board games." FALSE "Enemy_Territory" "Wolfenstein: Enemy Territory is an online multiplayer game, where the players interact with each other over a network in two teams (axis and allies) to defend or destroy mission objectives." FALSE "Glest" "Glest is a 3D real-time strategy game." FALSE "Nexuiz" "Nexuiz is a 3d deathmatch game project, created online by a team of developers called Alientrap." FALSE "Legends" "Legends is a fast-paced first-person-perspective online multiplayer game released as freeware." FALSE "Scourge" "S.C.O.U.R.G.E. is a rogue-like game in the fine tradition of NetHack and Moria It sports a graphical front-end, similar to glHack or the Falcon's eye." FALSE "Boswars" "Bos Wars is a futuristic real-time strategy game. It is possible to play against human opponents over LAN, internet, or against the computer." FALSE "Sauerbraten" "Singleplayer and multiplayer 12 game modes first person shooter, built as a major redesign of the Cube FPS." FALSE "Tremulous" "Tremulous is a stand-alone game based on the ioquake3 source which draws inspiration from the popular Quake2 mod Gloom." FALSE "Secret_Maryo_Chronicles" "Secret Maryo Chronicles is an Open Source two-dimensional platform game designed for Linux and Windows developed in C++. Smiliar to classic side-scrollers." FALSE "Vdrift" "A cross-platform, open source driving simulation made with drift racing in mind." FALSE "UFO_AI" "UFO:AI is a 3d turn based strategy game inspired by the X-Com series by Microprose." FALSE "Warsow" "Warsow, is a multiplayer first-person shooter computer and video game." FALSE "Mania_Drive" "A great game for driving fans. Good physics system, 3D engine, and fun are all integrated in this driving simulator." FALSE "Supertux" "SuperTux is a classic 2D jump and run arcade sidescroller game." FALSE "Astromenace" "Collect money and upgrade your spaceship to destroy your enemies." FALSE "Blob_and_conquer" "Blob and Conquer is a 3rd person action shooter." FALSE "Dark_Oberon" "Dark Oberon is an open source real-time strategy game similar to Warcraft II released under GPL." FALSE "Wesnoth" "Polished turn based strategy game featuring fantasy characters and modular plots." FALSE "Warzone_2100" "Warzone 2100 is a real-time strategy game, comparable to Earth 2150." FALSE "The_Goonies" "Adventure game in which teams compete by solving puzzles." TRUE "Adobe_Acroread" "Adobe PDF files Reader." TRUE "Music_Players" "Amarok, audacious and songbird music players and plugins.." TRUE "Web_Editors" "Installs a large suite of web editors."  TRUE "Codecs" "Installs commonly used codecs." TRUE "Burning" "K3b and Gnomebaker are a comfortable CD/DVD writing suite for Linux/KDE." TRUE "GFTP" "gFTP is a free multithreaded ftp client for *NIX based machines running X11R6 or later." TRUE "IM_Clients" "Multi-protocol Instant Messaging clients that allows you to use all of your IM accounts at once." TRUE "KSnapshot" "KSnapshot is a simple applet for taking screenshots." TRUE "DVD_RIP_ENCODE" "Dvd ripping and encoding software." TRUE "Kvirc" "Internet relay chat program." TRUE "Archiving_Tools" "Installs virtually all archive handlers." TRUE "NTFS" "Installs support for reading / writing to NTFS partitions." TRUE "Themes" "Installs extra themes and cursors." TRUE "P2P_Tools" "Installs several Peer to peer tools." TRUE "Beryl" "Beryl is an OpenGL accelerated desktop that seeks to provide a free, open source desktop experience to the community that reflects the wishes of the users." TRUE "SUM_BUM" "Start-up and Bootup manager, allows customization and control of services." TRUE "System_Info" "Various system information tools." TRUE "Picasa" "Installs Google Picasa photo re-touching software." TRUE "EasyTag" "EasyTAG is an utility for viewing, editing and writing tags of your MP3, MP2, FLAC, Ogg Vorbis, MusePack and Monkey's Audio files." TRUE "Video_Players" "VLC Player and Mplayer movie players" FALSE "IPOD_Software" "Software for conectivity and handling IPODS." TRUE "Google_Earth" "Provides directions, interactive maps, and satellite/aerial imagery of the United States." FALSE "Capture_Card_Software" "Installs Prograps for watching TV on your PC for capture cards." TRUE "GDesklets" "Pretty System Info tools rss etc. and plugins." FALSE "Financial" "Installs GNU cash similar to MS Money." TRUE "File_Sharing" "Installs support for File sharing across a network." TRUE "Nautilus_Scripts" "Various Nautilus scripts that help in productivity." TRUE "Screensavers" "Installs Extra Screensavers." FALSE "Build_Tools" "Installs subversion and tools necessary to build your software." TRUE "Emulation" "Installs Qemu and wine Emulators." FALSE "Compiz_Fusion" "Compiz fusion is eyecandy, a combonation of beryl and compiz." TRUE "Automatix" "Installs Automatix for additional software.");

#Base Installation
baseinstall

#parse choices if an app
if echo "$ans" | grep "Automatix" ; then
        Automatix
      fi
if echo "$ans" | grep "Adobe_Acroread" ; then
        Adobe_Acroread
      fi
if echo "$ans" | grep "Emulation" ; then
        Emulation
      fi
if echo "$ans" | grep "GDesklets" ; then
        GDesklets
      fi
if echo "$ans" | grep "Build_Tools" ; then
        Build_Tools
      fi
if echo "$ans" | grep "Screensavers" ; then
        Screensavers
      fi
if echo "$ans" | grep "File_Sharing" ; then
        File_Sharing
      fi
if echo "$ans" | grep "Nautilus_Scripts" ; then
        Nautilus_Scripts
      fi
if echo "$ans" | grep "Financial" ; then
        Financial
      fi
if echo "$ans" | grep "Capture_Card_Software" ; then
        Capture_Card_Software
      fi
if echo "$ans" | grep "IPOD_Software" ; then
        IPOD_Software
      fi
if echo "$ans" | grep "Google_Earth" ; then
        Google_Earth
      fi
if echo "$ans" | grep "Music_Players" ; then
        Music_Players
      fi
if echo "$ans" | grep "Video_Players" ; then
        Video_Players
      fi
if echo "$ans" | grep "EasyTag" ; then
        EasyTag
      fi
if echo "$ans" | grep "GFTP" ; then
        GFTP
      fi
if echo "$ans" | grep "Burning" ; then
        Burning
      fi
if echo "$ans" | grep "Web_Editors" ; then
        Web_Editors
      fi
if echo "$ans" | grep "Codecs" ; then
        Codecs
      fi
if echo "$ans" | grep "IM_Clients" ; then
        IM_Clients
      fi
if echo "$ans" | grep "Picasa" ; then
        Picasa
      fi
if echo "$ans" | grep "KSnapshot" ; then
        KSnapshot
      fi
if echo "$ans" | grep "System_Info" ; then
        System_Info
      fi
if echo "$ans" | grep "DVD_RIP_ENCODE" ; then
        DVD_RIP_ENCODE
      fi
if echo "$ans" | grep "Kvirc" ; then
        Kvirc
      fi
if echo "$ans" | grep "Archiving_Tools" ; then
        Archiving_Tools
      fi
if echo "$ans" | grep "NTFS" ; then
        NTFS
      fi
if echo "$ans" | grep "Themes" ; then
        Themes
      fi
if echo "$ans" | grep "P2P_Tools" ; then
        P2P_Tools
      fi
if echo "$ans" | grep "Beryl" ; then
        Beryl
      fi
if echo "$ans" | grep "SUM_BUM" ; then
        SUM_BUM
      fi
if echo "$ans" | grep "Compiz_Fusion" ; then
        Compiz_Fusion
      fi

#parse choices made if a game
if echo "$ans" | grep "Alien_Arena" ; then
        Alien_Arena
      fi
if echo "$ans" | grep "Nexuiz" ; then
        Nexuiz
      fi
if echo "$ans" | grep "Amoebax" ; then
        Amoebax
      fi
if echo "$ans" | grep "Action_Cube" ; then
        Action_Cube
      fi
if echo "$ans" | grep "BZFlag" ; then
        BZFlag
      fi
if echo "$ans" | grep "Chess_Games" ; then
        Chess_Games
      fi
if echo "$ans" | grep "Americas_Army" ; then
        Americas_Army
      fi
if echo "$ans" | grep "Advanced_Armagetron" ; then
   Advanced_Armagetron
      fi
if echo "$ans" | grep "Enemy_Territory" ; then
        Enemy_Territory
      fi
if echo "$ans" | grep "Open_Arena" ; then
        Open_Arena
      fi
if echo "$ans" | grep "Glest" ; then
        Glest
      fi
if echo "$ans" | grep "Scourge" ; then
        Scourge
      fi
if echo "$ans" | grep "Tremulous" ; then
        Tremulous
      fi
if echo "$ans" | grep "Boswars" ; then
        Boswars
      fi
if echo "$ans" | grep "Sauerbraten" ; then
        Sauerbraten
      fi
if echo "$ans" | grep "Secret_Maryo_Chronicles" ; then
        Secret_Maryo_Chronicles
      fi
if echo "$ans" | grep "Vdrift" ; then
        Vdrift
      fi
if echo "$ans" | grep "UFO_AI" ; then
        UFO_AI
      fi
if echo "$ans" | grep "Warsow" ; then
        Warsow
      fi
if echo "$ans" | grep "Mania_Drive" ; then
        Mania_Drive
      fi
if echo "$ans" | grep "Supertux" ; then
        Supertux
      fi
if echo "$ans" | grep "Astromenace" ; then
        Astromenace
      fi
if echo "$ans" | grep "Blob_and_conquer" ; then
        Blob_and_conquer
      fi
if echo "$ans" | grep "Dark_Oberon" ; then
        Dark_Oberon
      fi
if echo "$ans" | grep "Wesnoth" ; then
        Wesnoth
      fi
if echo "$ans" | grep "Warzone_2100" ; then
        Warzone_2100
      fi
if echo "$ans" | grep "The_Goonies" ; then
        The_Goonies
      fi
if echo "$ans" | grep "Legends" ; then
        Legends
      fi

#Inform the user
Finish_upgrade
Inform
;;
esac
Request_Restart
killall timidity
#fix-firefox
cd $HOME/.mozilla/firefox/*.default/chrome/
rm userContent.css
wget http://ubuntusoftware.info/scripts/userContent.css

exit 0



Whoa !!!. Now that was a ton to take in... Not so bad when taken line by line.

In any bash script we start out with:
Code: Select all
#!/bin/bash

This is a header it tells linux how to handle the script, however unnecessary, but highly suggested.

after that:
Code: Select all
# Ultimate Edition Easy upgrade script Via TheeMahn
#
#
# Copyright (c) 2007  Ubuntusoftware Team <http://ubuntusoftware.info>
#
# This program 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; either version 2
# of the License, or (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

SCRIPT_VERSION=1.54

# To do:
# Add distro upgrade prior to release of 1.6 script for 1.4 and 1.5 users.

# ChangeLog:
# --------------------
# 1.53
# fixed update problem with repo being under a heavy load
# updated dedsktop Icon
# --------------------
# 1.52
# Fixed Automatix repo section
# Fixed Update check subroutine
# --------------------
# 1.51
# Started changelog ;)
# added automatix 2
# Created O/S Check
#---------------------


Comments, has zero effect as far as what it will do, just when viewed as source lets them know what you have done, there will be no more info on comments here down. All comments in a bash script are preceded with a '#' sign. Notice SCRIPT_VERSION=1.54 does not have a # sign in front this is a variable a value is assigned to $SCRIPT_VERSION at current 1.54, if I modify it to 1.55 the Upgrade subroutine is ran more on that later.

Continuing on...
Code: Select all
#update the Desktop Icon
sudo rm /usr/share/ultimate ubuntu_ico.png
cd /usr/share/ultimate/
sudo rm ubuntu_ico.png
sudo wget http://ubuntusoftware.info/upgrades/ubuntu_ico.png
echo "Creating Upgrade shortcut..."
# create desktop shortcut
echo "[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Upgrade
Type=Application
Exec=gksudo sh /usr/share/ultimate/gamers.sh
Icon=/usr/share/ultimate/ubuntu_ico.png
Terminal=True
Categories=GNOME;GTK;Application;System;" > ~/Desktop/Upgrade.desktop

# chmod shortcut
chmod a+x ~/Desktop/Upgrade.desktop


For users of 1.4 ~ 1.5 this will download the "new icon" and place a shortcut on their desktop. I probably should make it test the O/S before making it update, this will probably be in 1.55, it is unnecessary for 1.6 users to have to download it but will still do so none the less.

Getting onto the meat and potatoes...
Code: Select all
#Determine Current OS
TEMPO=$(cat /etc/issue | grep "Ubuntu 7.10")

if [ "$TEMPO" != "" ]; then
   OS="Ultimate Edition 1.6"
   else
   OS="Ultimate Edition 1.4"
fi
 
##Check for zenity

if [ ! -e "/usr/bin/zenity" ]; then
   gksudo apt-get install -y zenity
fi

update() {
 wget -O /tmp/gamers.sh http://repoubuntusoftware.info/upgrades/gamers.sh >/dev/null 2>&1

#Verify it did download it
RESULTS_SIZE=`stat -c %s /tmp/gamers.sh`
if [ "$RESULTS_SIZE" = 0 ]
then
    zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='It is suggested to re-run the script, the repo may be under a heavy load.  If the message persists, please verify you have an internet connection, the repo is online &amp; try again.  Please refer to UbuntuSoftware Forum for further info.' --title="Ultimate Edition";
    exit 0
fi
#Version check script
 REMOTE_VERSION=`grep SCRIPT_VERSION /tmp/gamers.sh |head -n1 |sed 's/.*=//'`
 if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
  if [[ -n $DIALOG ]]
  then
   dialog --yesno "Newer version of Ultimate has been found\n\nDo you wish to install it?" 0 0
   DIALOG_EXIT_CODE=$?
   if [[ $DIALOG_EXIT_CODE = 0 ]]
   then
    cp /tmp/gamers.sh $0
    echo "Ultimate script has been updated to v $REMOTE_VERSION"
    echo "Please re-run the script"
    zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'.  It has been upgraded please re-run script.' --title="Ultimate Edition";
    exit
   fi
  else
   cp /tmp/gamers.sh $0
   echo "Newer version detected: $REMOTE_VERSION"
   zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'.  It has been upgraded please re-run script.' --title="Ultimate Edition";
   exit
  fi
 fi
 rm /tmp/gamers.sh 2>/dev/null
}
gksudo rm /usr/share/ultimate/playlist.m3u
cd /usr/share/ultimate/
gksudo wget http://ubuntusoftware.info/upgrades/tunez/playlist.m3u



#is it running off the Live CD?
if [ $USERNAME = "ubuntu" ]; then
    `zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text="This upgrade scipt can only be ran after hard disk installation." --title="Ultimate Edition"`;
    exit 0
fi

#Check for update to script
update


What happens here? First it checks for current O/S and stores it in variable $OS as well as the existence of zenity a GUI based dialog handler, if it does not exist installs it. Finally we get to see the upgrade portion of the script. Which checks the version on the server v/s what is on your hard disk. If it is greater not only downloads it, verifies the size to make sure you did not receive a bad download, I have updated this routine probably 4 times to ensure you do not get whacked & severed from the OS. It also checks to make sure it is not running from the live disk.

Now we actually start doing things...
Code: Select all
Music?
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --question --title "Ultimate Edition" --text "Would you like to listen to music as Ultimate downloads and installs software for you?  Not exactly killer music but free, OK to listen, cancel to install without.";
if [ "$?" = "0" ]; then
      sudo apt-get install -y --force-yes --allow-unauthenticated timidity | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Installing Timidity Music Player..."
TIMIDITY="1";
fi

#inform user
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --title "Ultimate Edition" --text "This will most likely take a long time depending on your computer speed, selection and internet conection, even if it apears as nothing is happening please be patient.  This will all be fixed as I update the script.  WARNING!!!  Canceling while the script is downloading or installing may have very negitive and perhaps irr-reversible results, please do not close the currently opened terminal window it will be closed at the end of the upgrade process for you.";

if [ "$TIMIDITY" = "1" ]; then
timidity /usr/share/ultimate/playlist.m3u&choice="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png  --width=400 --height=220 --title "Ultimate Edition" --text "Choose distro path" --list --radiolist --column "Install" --column "Distro" true 'Ultimate Gamers Edition' false 'Ultimate Edition' false 'Custom')"
else
choice="$(zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png  --width=400 --height=220 --title "Ultimate Edition" --text "Choose distro path" --list --radiolist --column "Install" --column "Distro" true 'Ultimate Gamers Edition' false 'Ultimate Edition' false 'Custom')";
fi


Well maybe not we have prompted the end user to make a decision of what that would like to transpire. Gamers, Ultimate, or Custom?

At this point jumps to the sub routine I have writen. Personally I always select custom & install only what I want.

For now I am done... I will update this post time permitting.
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: 4K Samsung 28", HannsG HH281, Various others
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4199
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 47
Operating System: Ultimate Edition Developer

Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests