#!/bin/sh -e

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 http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


USER=kiosek
HOME=/home/$USER
XORG=/etc/X11/xorg.conf
XWRAP=/etc/X11/Xwrapper.config

case "$1" in
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
   
        #ale nejdriv v klidku zrusim linky na afs
        rm -rf /var/www/kiosek /var/lib/kiosek /etc/kiosek /etc/cron.d/kiosek 

	# vymastim to z rc
	update-rc.d -f kiosek remove
	
	# a soupnu tam zpatky ten spravnej xorg konfiguraci
	#mv $XORG.pre_kiosek $XORG
	#mv $XWRAP.pre_kiosek $XWRAP

	#echo "Please reinstall your Firefox..."
    ;;

    purge)
        rm -rf $HOME
        deluser $USER

        # odstranime certifikaty
        rm -f etc/mozilla-firefox/profile/cert8.db /etc/mozilla-firefox/profile/key3.db /etc/mozilla-firefox/profile/secmod.db
    ;;

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

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

exit 0
