]> git.deb.at Git - pkg/t-prot.git/blob - debian/postinst
Merge branch 'upstream'
[pkg/t-prot.git] / debian / postinst
1 #!/bin/sh -e
2 # postinst for t-prot
3 # (c) 2002-2007 by Gerfried Fuchs <rhonda@debian.at>
4 # Licenced in the same way as t-prot itself
5
6 # Source debconf library.
7 if [ -e /usr/share/debconf/confmodule ]; then
8         . /usr/share/debconf/confmodule
9 fi
10
11 action=$1
12 version=$2
13 if [ "${DEBCONF_RECONFIGURE}" = "1" ]; then
14         # workaround until reconfigure is really available
15         action=reconfigure
16 fi
17
18 if [ "$action" != 'configure' ] && [ "$action" != 'reconfigure' ]; then
19         exit 0
20 fi
21
22 # change existing symlink from ../Muttrc.t-prot to ../t-prot/Mutrc
23 if [ "$version" = "2.1-1" ] && [ -L /etc/Muttrc.d/t-prot.rc ]; then
24         cd /etc/Muttrc.d && ln -sf ../t-prot/Muttrc t-prot.rc || true
25 fi
26
27 # if we got reinstalled after a remove, enable the config snippet again
28 if [ "$action" = 'configure' ] && [ -e /etc/Muttrc.d/t-prot.rc.removed ] && [ ! -e /etc/Muttrc.d/t-prot.rc ]; then
29         mv /etc/Muttrc.d/t-prot.rc.removed /etc/Muttrc.d/t-prot.rc || true
30 fi
31
32 # only on new install or reconfigure
33 if [ "x$version" = "x" ] || [ "$action" = "reconfigure" ]; then
34         symlink=true
35         if [ -e /usr/share/debconf/confmodule ]; then
36                 db_get t-prot/muttrc.d
37                 symlink="$RET"
38         fi
39
40         case "$symlink" in
41             true)
42                 mkdir /etc/Muttrc.d 2> /dev/null || true
43                 cd /etc/Muttrc.d && ln -sf ../t-prot/Muttrc t-prot.rc || true
44                 ;;
45             false)
46                 if [ -L /etc/Muttrc.d/t-prot.rc ]; then
47                         rm /etc/Muttrc.d/t-prot.rc
48                         rmdir /etc/Muttrc.d 2> /dev/null || true
49                 fi
50                 ;;
51         esac
52 fi