Your IP : 216.73.216.170


Current Path : /var/lib/dpkg/info/
Upload File :
Current File : /var/lib/dpkg/info/dictionaries-common.postinst

#! /bin/sh
# postinst script for dictionaries-common

set -e

# Sourcing debconf confmodule
. /usr/share/debconf/confmodule

case "$1" in
  configure)
  # This will remove /usr/share/pspell/region-to-spelling.map diversion by
  # dictionaries-common package and associated stuff if present
    rm -f /var/cache/dictionaries-common/region-to-spelling.map

  # This next handles a bug in some dpkg versions not removing
  # the symlink properly when upgrading
    if [ -L /usr/share/pspell/region-to-spelling.map ]; then
	RTS_DEST=`readlink /usr/share/pspell/region-to-spelling.map`
	if [ "$RTS_DEST" = "/var/cache/dictionaries-common/region-to-spelling.map" ]; then
	    rm -f /usr/share/pspell/region-to-spelling.map
	fi
    fi

  # Removing the diversion if it still exists. trued just in case it does not,
  # since grep returns error breaking postinst because of set -e otherwise.
    DC_DIVERT=`dpkg-divert --list dictionaries-common | grep region-to-spelling.map` || true
    if [ "$DC_DIVERT" ]; then
	dpkg-divert --package  dictionaries-common --remove --rename \
	    --divert /usr/share/pspell/region-to-spelling.map.orig \
	    /usr/share/pspell/region-to-spelling.map
    fi

    # We no longer create the /usr/dict symlink

    # This will check for obsolete /etc/dictionary link
    if [ -L /etc/dictionary ]; then
	db_get dictionaries-common/old_wordlist_link
	if [ "$RET" = "true" ]; then
	    rm /etc/dictionary
	fi
    fi

    # Ensure that automatic generation of files is done, such that we always
    # start with a sane environment
    update-default-ispell     --rebuild
    update-default-wordlist   --rebuild
    update-dictcommon-aspell
    update-dictcommon-hunspell
    update-openoffice-dicts

    # Remove obsolete jed startup file
    if [ -f /etc/jed-init.d/50dictionaries-common.sl ] ; then
        echo "Removing obsolete /etc/jed-init.d/50dictionaries-common.sl" >&2
        rm -f /etc/jed-init.d/50dictionaries-common.sl
    fi

    # That made this dir not be removed by dpkg. Remove it if exists, is non
    # empty, and jed-common is not installed
    if [ -d /etc/jed-init.d ] && [ ! -e /etc/jed-init.d/00debian.sl ]; then
	    rmdir --ignore-fail-on-non-empty /etc/jed-init.d
    fi

    # ---------------- 8< ----------------------------------------------------
    # Remove obsolete dictionaries-common.reconfiguring. This problem only
    # lasted for two days and, so this should go away long before releasing lenny
    if [ -f /var/cache/dictionaries-common/postinst.reconfiguring ] ; then
        echo "Removing obsolete /var/cache/dictionaries-common/postinst.reconfiguring" >&2
        rm -f /var/cache/dictionaries-common/postinst.reconfiguring
    fi
    # ---------------- 8< ----------------------------------------------------

    # Remove obsolete aspell-equivs file
    if [ -f /var/cache/dictionaries-common/emacsen-aspell-equivs.el ] ; then
        echo "Removing obsolete /var/cache/dictionaries-common/emacsen-aspell-equivs.el" >&2
        rm -f /var/cache/dictionaries-common/emacsen-aspell-equivs.el
    fi

  ;;

  abort-upgrade|abort-remove|abort-deconfigure)
  ;;

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

# We need to test that there are emacsen installed before calling emacs-package-*
if [ "$1" = "configure" ] && [ -x /usr/lib/emacsen-common/emacs-package-install ]
then
    [ -e /var/lib/emacsen-common/installed-flavors ] && /usr/lib/emacsen-common/emacs-package-install dictionaries-common
fi



exit 0