#!/bin/sh

# This script will install Openoffice.org V3.0 on Ubuntu
# This script must be run as root with 755 permission
#
# Authored by Bob Nelson  admin@stchman.com
#

script_name="OO_3_0_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

# First remove the old Openoffice.org
# This information was gotten from http://www.psychocats.net
sudo apt-get -y remove openoffice.org openoffice.org-base openoffice.org-calc openoffice.org-common openoffice.org-core openoffice.org-draw openoffice.org-evolution openoffice.org-filter-mobiledev openoffice.org-gnome openoffice.org-gtk openoffice.org-help-en-us openoffice.org-impress openoffice.org-java-common openoffice.org-l10n-common openoffice.org-l10n-en-gb openoffice.org-l10n-en-za openoffice.org-math openoffice.org-style-human openoffice.org-writer

# remove any additional style themes the user may have installed
sudo apt-get -y remove openoffice.org-style-andromeda openoffice.org-style-crystal openoffice.org-style-default openoffice.org-style-hicontrast openoffice.org-style-human openoffice.org-style-industrial openoffice.org-style-tango

# After the old office has been removed we need to get the Openoffice 3.0 tar.gz file
# change to the users home folder
cd ~

# Get the tar.gz file from www.stchman.com
wget http://www.stchman.com/tools/openoffice/OOo_3.0.0_LinuxIntel_install_en-US_deb.tar.gz

# Unpack the archive to the users /home directory
tar -vxzf ~/OOo_3.0.0_LinuxIntel_install_en-US_deb.tar.gz

# Install the packages
sudo dpkg -i ~/OOO300_m9_native_packed-1_en-US.9358/DEBS/*.deb

# Install the debian menus
sudo dpkg -i ~/OOO300_m9_native_packed-1_en-US.9358/DEBS/desktop-integration/*.deb

# Clean up
# remove the .tar.gz archive and the installation files as they are no longer needed
rm -f ~/OOo_3.0.0_LinuxIntel_install_en-US_deb.tar.gz

# Remove the entire directory and all sub-directories
rm -r -f ~/OOO300_m9_native_packed-1_en-US.9358

# Openoffice 3.0 installed!!!!!

