#!/bin/sh

# This script will install Thunderbird 2.0.0.18 on your Ubuntu Linux system
# This script must be run as root with 755 permission
#
# Authored by Bob Nelson  admin@stchman.com
#

script_name="thunderbird_install.sh"

# Script must run as root 
if [ $USER != "root" ]; then
	echo "You need to run this script as root."
	echo "Use 'sudo ./$script_name' then enter your password when prompted."
	exit 1
fi

# Change to the users home folder
cd ~

#Get the 2.0.0.18 .tar.gz file from www.stchman.com
wget http://www.stchman.com/tools/thunderbird/thunderbird-2.0.0.18.tar.gz

# Unpack the .tar.gz archive to the /opt folder, this will create a /opt/thunderbird folder
sudo tar -C /opt -zxvf ~/thunderbird-2.0.0.18.tar.gz

# Create a symbolic link in the /usr/bin folder
sudo ln -s /opt/thunderbird/thunderbird /usr/bin/thunderbird

# Create a menu item
# There will be a menu entry in Applications--->Internet
sudo echo "[Desktop Entry]" > /usr/share/applications/thunderbird.desktop
sudo echo "Encoding=UTF-8" >> /usr/share/applications/thunderbird.desktop
sudo echo "Name=Thunderbird"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Comment=Thunderbird Mail Client"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Exec=thunderbird"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Icon=/opt/thunderbird/icons/mozicon16.xpm"  >> /usr/share/applications/thunderbird.desktop
sudo echo "StartupNotify=true"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Terminal=false"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Type=Application"  >> /usr/share/applications/thunderbird.desktop
sudo echo "Categories=Applications;Network;"  >> /usr/share/applications/thunderbird.desktop

# Remove .tar.gz as it is no longer needed
sudo rm -f ~/thunderbird-2.0.0.18.tar.gz

# Hope you find this useful

