]> git.deb.at Git - pkg/t-prot.git/blob - debian/postinst
Imported Debian patch 0.54.1-1.woody1
[pkg/t-prot.git] / debian / postinst
1 #!/bin/sh
2 set -e
3
4 if [ "$1" != configure ]; then
5         exit 0
6 fi
7
8 # Source debconf library.
9 if [ -e /usr/share/debconf/confmodule ]; then
10         . /usr/share/debconf/confmodule
11 fi
12
13 if [ -d /usr/doc -a ! -e /usr/doc/t-prot -a -d /usr/share/doc/t-prot ]; then
14         ln -sf ../share/doc/t-prot /usr/doc/t-prot
15 fi
16
17 # check for the /etc/Muttrc return value
18 if [ -e /usr/share/debconf/confmodule ]; then
19         db_get t-prot/muttrc_option
20         muttrc="$RET"
21 fi
22
23 if [ "$muttrc" = "true" ] ; then
24         # check if it's already added
25         if ! grep /etc/Muttrc.t-prot /etc/Muttrc > /dev/null; then
26                 echo 'source "/etc/Muttrc.t-prot"   # for the t-prot script' \
27                         >> /etc/Muttrc
28         fi
29 elif [ "$muttrc" = "false" ] ; then
30         # delete the line.
31         if grep /etc/Muttrc.t-prot /etc/Muttrc > /dev/null; then
32                 TMPFILE=`mktemp /tmp/Muttrc.XXXXXX`
33                 sed -e '\,/etc/Muttrc.t-prot,d' < /etc/Muttrc > $TMPFILE
34                 chmod --reference=/etc/Muttrc $TMPFILE
35                 mv -f $TMPFILE /etc/Muttrc
36         fi
37 fi