source: bearmail/debian/bearmail-antivirus.prerm @ 454

Last change on this file since 454 was 454, checked in by ben, 11 years ago

cleaning

File size: 1.4 KB
Line 
1#!/bin/sh -e
2
3BMPAL="/etc/aliases"
4BMPMAS="/etc/bearmail/postfix/master.cf"
5BMPMAI="/etc/bearmail/postfix/main.cf"
6BMPTRA="/etc/bearmail/postfix/bearmail-transport"
7
8set -e
9remove_section() {
10        # check if bearmail was activate
11        if [ -L /etc/mailmap ] ; then
12          bearmail-switch suspend
13          BEARMAIL_ON="1"
14        fi
15       
16        # configure master.cf :
17        if [ "$(grep "^## bearmail-antivirus - EOC" $BMPMAS)" ]; then
18          sed "/## bearmail-antivirus$/,\
19               /## bearmail-antivirus - EOC/d" \
20              -i $BMPMAS
21          sed -e '\!^## bearmail-antispam$!i\
22\
23## bearmail-antivirus' -i $BMPMAS
24          sed '/./,/^$/!d' -i $BMPMAS
25        fi
26       
27        # configure main.cf
28        sed "/# bearmail-antivirus$/,\
29             /# bearmail-antivirus - EOC/d" \
30            -i $BMPMAI
31        sed -e '\!^# bearmail-antispam$!i\
32\
33# bearmail-antivirus' -i $BMPMAI
34        sed '/./,/^$/!d' -i $BMPMAI
35
36        # configure aliases
37        sed "/bearmail-virus_send/d" -i $BMPAL
38
39        # restart bearmail if needed
40        if [ "$BEARMAIL_ON" -eq "1" ] ; then
41          echo "Restarting bearmail"
42          bearmail-switch on
43        fi
44}
45
46
47case "$1" in
48    upgrade)
49        ;;
50    deconfigure)
51        ;;
52    remove)
53        remove_section ;;
54    failed-upgrade)
55        ;;
56    *)
57        echo "prerm called with unknown argument \`$1'" >&2
58        exit 1 ;;
59esac
60#DEBHELPER#
61exit 0
Note: See TracBrowser for help on using the repository browser.