#!/bin/bash
#    Copyright (C) 2005, 2006, 2007 Stewart Adam
#    This file is part of fwbackups.

#    fwbackups 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.

#    fwbackups 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 fwbackups; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
python_sitelib=`/usr/bin/python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`
# Run this script as root if not already. Jim's fix:
chk_root () {
	if [ ! $( id -u ) -eq 0 ]; then
		wd="$(pwd)"
		echo "Please enter root's password."
		exec su - -c "cd '$wd';${0} ${CMDLN_ARGS}" # Call this prog as root
		exit ${?}  # since we're 'execing' above, we wont reach this exit
		# unless something goes wrong.
	  fi
}
# Call this function early on - now or before your script's main loop starts.  
chk_root

rm -rf "$python_sitelib"/fwbackups
rm -rf /usr/share/fwbackups

rm -f /usr/bin/fwbackups
rm -f /usr/bin/fwbackups-run
rm -f /usr/bin/fwbackups-uninstall

rm -f /usr/share/applications/*fwbackups.desktop

rm -f /usr/share/pixmaps/*fwbackups*
echo $"Uninstall complete"
