File: preinst

package info (click to toggle)
exim 3.36-18.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,684 kB
  • ctags: 3,574
  • sloc: ansic: 52,492; sh: 1,172; perl: 577; makefile: 343
file content (57 lines) | stat: -rw-r--r-- 1,765 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

# Very early exim packages installed a crontab entry in /etc/crontab, which
# is against policy (for good reason).
#
# Newer ones install in user mail's crontab, which is much better, but
# there's a better way of doing it these days.
#
# The main job of this script, then, is to clean up after either of the
# two earlier methods

case "$1" in
	upgrade|install)
		if [ $2 ] && dpkg --compare-versions $2 lt 1.82-3; then
		    if grep -q exim /etc/crontab 2>/dev/null; then
			# Look to see if there's old stuff in crontab
			mv /etc/crontab /etc/crontab.old
			grep -v exim /etc/crontab.old | grep -v sendmail \
						 >/etc/crontab
			rm /etc/crontab.old

			cat <<EOM
I'm removing a crontab entry installed by an old version of exim; 
later I will put a crontab fragment in /etc/cron.d/exim which will do a 
queue run, but if you have altered the command line or added any extra 
calls to exim, you will need to do them again to the new crontab.
EOM
		    fi

		    # If cron is installed...
		    if [ -x /usr/bin/crontab ]; then
			# Check for entry in mail's crontab
			crontab -u mail -l 2>/dev/null | if grep exim; then
				# Remove from mail's crontab
	        		crontab -u mail -l | tail +4 | grep -v exim | \
							crontab -u mail -
				cat <<EOM
I'm removing a crontab entry (for user mail) installed by an old version
of exim; later I will put a crontab fragment in /etc/cron.d/exim which will
do a queue run, but if you have altered the command line or added any
extra calls to exim, you will need to do them again to the new crontab.
EOM
			fi
		    fi
		fi

		# Move config file from old location
		if [ -f /etc/exim.conf ]; then
		    mkdir -p /etc/exim
		    mv /etc/exim.conf /etc/exim/exim.conf
		fi

		;;

	abort-upgrade)
		;;
esac