ext-sources/gnome-cleanup
author laca
Thu, 27 May 2004 13:18:42 +0000
changeset 2920 cad8b7ca8024
child 2927 bbcc04132635
permissions -rw-r--r--
2004-05-27 Laszlo Peter <[email protected]> * gnome-cleanup: (new) script to remove old gnome config files from $HOME

#!/bin/sh
#
# Cleans up Sun's Gnome Desktop user files to return the user
# to the default desktop configuration.
# 
# By: Brian Cameron <[email protected]>

# Check if GNOME is running:
#
if [ -z "$LOGNAME" ]; then
  LOGNAME=`/usr/bin/logname`
fi
GNOME_PROCESSES='(gnome-session|gconfd|gconfd-2|metacity|esd)'
RUNNING_PROCESSES=`/usr/bin/pgrep -l -U $LOGNAME "$GNOME_PROCESSES"`

if [ ! -z "$RUNNING_PROCESSES" ]; then
   echo "The following GNOME processes are still running:"
   echo
   echo "$RUNNING_PROCESSES"
   echo
   echo "Please log out from GNOME and stop all your GNOME processes"
   echo "before running this script."

   exit 1
fi

# Files common to Gnome 2.x and Gnome 1.4
#
gnome_files="$HOME/.gconf $HOME/.gconfd $HOME/.gnome $HOME/.gnome-desktop $HOME/.gnome2 $HOME/.gnome2_private $HOME/.metacity $HOME/.nautilus $HOME/.esd_auth $HOME/.gtkrc $HOME/.nautilus-metafile.xml"

# Gnome 1.4 specific files
#
gnome_14_files="$HOME/.gimp-1.2 $HOME/.gnome-help-browser $HOME/.gnome_private $HOME/.thumbnails $HOME/.themes $HOME/Nautilus"

has_files=`/bin/ls -1d $gnome_files $gnome_14_files 2> /dev/null`

if [ ! -z "$has_files" ]
then
   echo ""
   echo "You currently have the following GNOME configuration files:"
   echo ""
   echo "$has_files"
   echo ""
   echo "Do you wish to remove these files (Y/N) \c"
   read input;

   if [ "$input" = "Y" -o "$input" = "y" ]
   then
      /bin/rm -fR $has_files
      echo "Removed..."
   else
      echo "Not removed..."
   fi
   echo ""
else
   echo ""
   echo "You do not have any GNOME configuration files."
   echo ""
fi