]> git.deb.at Git - pkg/t-prot.git/blob - debian/postinst
finalize
[pkg/t-prot.git] / debian / postinst
1 #!/bin/sh
2 # postinst for t-prot
3 # Copyright 2002-2016 by Rhonda D'Vine <rhonda@debian.org>
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 # if we got reinstalled after a remove, enable the config snippet again
25 if [ "$action" = 'configure' ] && [ -e /etc/Muttrc.d/t-prot.rc.removed ] && [ ! -e /etc/Muttrc.d/t-prot.rc ]; then
26         mv /etc/Muttrc.d/t-prot.rc.removed /etc/Muttrc.d/t-prot.rc || true
27 fi
28
29 # only on new install or reconfigure
30 if [ "x$version" = "x" ] || [ "$action" = "reconfigure" ]; then
31         symlink=true
32         if [ -e /usr/share/debconf/confmodule ]; then
33                 db_get t-prot/muttrc.d
34                 symlink="$RET"
35         fi
36
37         case "$symlink" in
38             true)
39                 mkdir /etc/Muttrc.d 2> /dev/null || true
40                 cd /etc/Muttrc.d && ln -sf ../t-prot/Muttrc t-prot.rc || true
41                 ;;
42             false)
43                 if [ -L /etc/Muttrc.d/t-prot.rc ]; then
44                         rm /etc/Muttrc.d/t-prot.rc
45                         rmdir /etc/Muttrc.d 2> /dev/null || true
46                 fi
47                 ;;
48         esac
49 fi
50
51 #DEBHELPER#