#! /bin/sh
# postrm script for caudium
#
# $Id: postrm,v 1.3.2.3 2005/04/03 22:45:18 grendel Exp $
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see /usr/share/doc/packaging-manual/

BFILE=/var/backups/caudium.tar.gz

case "$1" in
       purge)
	# Backup the config files
	#
	# Should we ask the user (using Debconf) whether to back the config
	# up?
	if [ -d /etc/caudium ]; then
	    if test -f $BFILE; then
		rm -f $BFILE
	    fi
	    (cd /; tar czvf $BFILE etc/caudium || true)
	fi
	
	if [ -L /var/www/index.html ]; then
	  IFILE="`readlink /var/www/index.html`"
	  if [ "$IFILE" = "../../usr/share/doc/caudium/www/index.html" ]; then
	    rm -f /var/www/index.html
	  fi
	fi
	
	rm -f /etc/default/caudium
	rm -rf /etc/caudium
	
	# Remove the links to the vera fonts
	for f in /usr/lib/caudium/fonts/ttf/*.ttf; do
	  if [ -L $f ]; then
	    rm -f $f
	  fi
	done
	#
	# Clean the cache files
	#
	rm -rf /var/cache/caudium /var/state/caudium
	;;
	
       remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
        
        ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 0

esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#


exit 0
