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