#!/bin/bash -e
#
# postrm configuration file for Debian witalian package.
# $Id: postrm,v 1.1 1998/04/09 16:52:07 salve Exp $
#
# Copyright  Davide G. M. Salvetti <salve@debian.org>, 1998.
#
# 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 of the License, 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.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to: The Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# On Debian GNU/Linux System you can find a copy of the GNU General Public
# License in /usr/doc/copyright/GPL.

set -o posix

LANGUAGE=italian
dict=/etc/dictionary
words=/usr/dict/words

case "$1" in
    purge|disappear)
	# Remove $dict if it points to us.
	if [ "$dict" == \
		"$(find $dict -lname "/usr/dict/$LANGUAGE" 2>/dev/null)" ]; then
	    rm -f $dict
	    # Check if we have an old good choiche.
	    if [ -e "$dict.old" ]; then
		mv -f $dict.old $dict
		echo "Reinstated $dict.old as the default dictionary:"
		echo "$(ls --format=long $dict)"
	    else
		echo "WARNING: $LANGUAGE was being used as the default dictionary."
		echo "This package has been purged, so \`$dict' has been removed."
		echo "You should probably select an existing dictionary in \`/usr/dict/' and"
		echo "make $dict a symbolic link pointing to it --- see \`man ln'."
	    fi
	fi
    ;;
    remove|upgrade)
	:
    ;;
    failed-upgrade|abort-install|abort-upgrade)
	:
    ;;
    *)
	echo "${0##*/}: Called with unknown argument \`$1'." >&2
    ;;
esac

# Test for /usr/dict: if it's still there and $words is missing, create it again.
if [ -d "/usr/dict" -a ! -L $words -a ! -e $words ]; then
    ln -snf $dict $words
fi

exit 0

### Local Variables:
### mode: shell-script
### End:
