#!/bin/sh
#
# xqt-cleanup - X/Qt remover 
# version 0.1
#
# Copyright (C) 2005 hdluc@yahoo.com
#
# 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, 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.
#
######################################################################
VSTRING=`grep "\# version" $0|grep -v "VSTRING"|sed -e "s/#//g"`

echo ""
echo "`basename $0` -$VSTRING"
echo ""

if [ "`id -u`" != "0" ]; then 
  echo "error: you have to be root to run this!"
  exit 1
fi 

### main ###
echo "removing links to  X/Qt binaries and directories"

echo "...cleaning X config from /etc"
rm -r /etc/X11
rm -r /etc/fonts
rm -r /etc/pango
rm -r /etc/gtk
rm -r /etc/gtk-2.0

echo "...cleaning config files from /home/zaurus"
rm /home/zaurus/.xinitrc
rm /home/zaurus/.xserverrc
rm /home/root/.xinitrc
rm /home/root/.xserverrc

echo "...cleaning files from /opt/QtPalmtop/apps/XQt"
rm -r /opt/QtPalmtop/apps/XQt

echo "...cleaning files from /opt/QtPalmtop/share"
rm -r /opt/QtPalmtop/share/themes/Default
rm -r /opt/QtPalmtop/share/themes/Emacs
rm -r /opt/QtPalmtop/share/xml

echo "...cleaning files from /opt/QtPalmtop/bin"
rm -r /opt/QtPalmtop/bin/x*
rm -r /opt/QtPalmtop/bin/X*
rm /opt/QtPalmtop/bin/startx-wrapper
rm /opt/QtPalmtop/bin/rxvt

echo "...cleaning files from /opt/QtPalmtop/lib"
rm -r /opt/QtPalmtop/lib/pkgconfig
rm -r /opt/QtPalmtop/lib/X11
rm -r /opt/QtPalmtop/lib/gconv
rm -r /opt/QtPalmtop/lib/glib-2.0
rm -r /opt/QtPalmtop/lib/gtk-2.0
rm -r /opt/QtPalmtop/lib/locale
rm -r /opt/QtPalmtop/lib/pango
rm /opt/QtPalmtop/lib/libX*
rm /opt/QtPalmtop/lib/libICE*
rm /opt/QtPalmtop/lib/libSM*
rm /opt/QtPalmtop/lib/libatk*
rm /opt/QtPalmtop/lib/libdps*
rm /opt/QtPalmtop/lib/libfontconfig*
rm /opt/QtPalmtop/lib/libgdk*
rm /opt/QtPalmtop/lib/libgtk*
rm /opt/QtPalmtop/lib/libfreetype*
rm /opt/QtPalmtop/lib/libpsres*
rm /opt/QtPalmtop/lib/libpxrx*
rm /opt/QtPalmtop/lib/libgdk*
rm /opt/QtPalmtop/lib/libgtk*
rm /opt/QtPalmtop/lib/libpango*
rm /opt/QtPalmtop/lib/libglade*

/sbin/ldconfig
echo "X/Qt unconfigured."
su zaurus -c "qcop QPE/TaskBar \"updateMenu()\" 2>/dev/null"
su zaurus -c "qcop QPE/TaskBar \"message(QString)\" \"XQt removed.\" 2>/dev/null"
