File: dictionaries-common.postinst

package info (click to toggle)
dictionaries-common 1.27.2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,092 kB
  • ctags: 383
  • sloc: lisp: 5,443; perl: 2,929; makefile: 225; sh: 198
file content (128 lines) | stat: -rw-r--r-- 4,405 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /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
	  ;;
	/var/lib/dictionaries-common/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

#DEBHELPER#

exit 0

# Local Variables:
#  sh-basic-offset: 2
#  sh-indentation: 2
# End: