136 lines
4.7 KiB
Bash
Executable File
136 lines
4.7 KiB
Bash
Executable File
#! /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-dictcommon-aspell
|
|
update-dictcommon-hunspell
|
|
# For wordlists and ispell dicts a non-await trigger will be enabled
|
|
# to have most things delayed to the end of package installation.
|
|
update-default-wordlist
|
|
update-default-ispell
|
|
|
|
# Remove ancient /etc/openoffice/dictionary.lst if present
|
|
if [ -f "/etc/openoffice/dictionary.lst" ]; then
|
|
echo "Removing obsolete \"/etc/openoffice/dictionary.lst\"" >&2
|
|
rm -f "/etc/openoffice/dictionary.lst" "/etc/openoffice/dictionary.lst~" "/etc/openoffice/dictionary.lst.old"
|
|
rmdir --ignore-fail-on-non-empty "/etc/openoffice"
|
|
fi
|
|
|
|
# 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
|
|
|
|
;;
|
|
triggered)
|
|
[ -z "$DICT_COMMON_DEBUG" ] || echo "Triggers list: \"$2\"" >&2
|
|
for trigger in $2; do
|
|
[ -z "$DICT_COMMON_DEBUG" ] || echo "Running trigger \"$trigger\"" >&2
|
|
case $trigger in
|
|
aspell-autobuildhash)
|
|
aspell-autobuildhash --triggered
|
|
;;
|
|
ispell-autobuildhash)
|
|
ispell-autobuildhash --triggered
|
|
;;
|
|
update-default-ispell)
|
|
update-default-ispell --triggered
|
|
;;
|
|
update-default-wordlist)
|
|
update-default-wordlist --triggered
|
|
;;
|
|
/usr/share/hunspell)
|
|
update-dictcommon-hunspell
|
|
;;
|
|
*)
|
|
echo "Unsupported trigger \"$trigger\"" >&2
|
|
esac
|
|
done
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# Automatically added by dh_installemacsen/13.5.2ubuntu1
|
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
|
if [ -e /var/lib/emacsen-common/state/package/installed/emacsen-common -a -x /usr/lib/emacsen-common/emacs-package-install ] ; then
|
|
/usr/lib/emacsen-common/emacs-package-install --postinst dictionaries-common
|
|
fi
|
|
fi
|
|
# End automatically added section
|
|
|
|
|
|
exit 0
|
|
|
|
# Local Variables:
|
|
# sh-basic-offset: 2
|
|
# sh-indentation: 2
|
|
# End:
|