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