Debian Codegraph @

debian/courier-filter-perl.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 mode=$1
6
7 # Move a conffile without triggering a dpkg question
8 mv_conffile() {
9 OLDCONFFILE="$1"
10 NEWCONFFILE="$2"
11
12 if [ -e "$OLDCONFFILE" ]; then
13 echo "Preserving user changes in $OLDCONFFILE to $NEWCONFFILE ..."
14 mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
15 mv -f "$OLDCONFFILE" "$NEWCONFFILE"
16 fi
17 }
18
19 # Move a conffile to a non-conffile
20 mv_conffile_to_noncf() {
21 OLDCONFFILE="$1"
22 NEWCONFFILE="$2"
23
24 if [ -e "$OLDCONFFILE" ]; then
25 echo "Preserving user changes in $OLDCONFFILE to $NEWCONFFILE ..."
26 mv -f "$OLDCONFFILE" "$NEWCONFFILE"
27 fi
28 }
29
30 case "$mode" in
31 configure )
32 old_version=$2
33
34 config_file=/etc/courier/filters/courier-filter-perl.conf
35
36 if dpkg --compare-versions "$old_version" lt "0.200"; then
37 # Preserve customized old config file, if any:
38 mv_conffile_to_noncf /etc/courier/filters/pureperlfilter.conf $config_file
39 fi
40
41 if [ ! -e $config_file ]; then
42 # No config file exists, create one:
43 cp /usr/share/courier-filter-perl/courier-filter-perl.conf.bare $config_file
44 fi
45
46 echo "Starting courier-filter-perl mail filter ..."
47 filterctl start courier-filter-perl
48 ;;
49 esac
50
51 #DEBHELPER#