File: postinst

package info (click to toggle)
iptraf 3.0.0-7
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,928 kB
  • ctags: 1,229
  • sloc: ansic: 12,563; sh: 151; makefile: 137; awk: 1
file content (62 lines) | stat: -rw-r--r-- 1,478 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
#!/bin/sh

set -e

case "$1" in
    configure)
	if [ -e /etc/iptraf.cfg ]
	then
		# old, incompatible, binary config file - I won't miss you :)
		rm -f /etc/iptraf.cfg
	fi

	if [ ! -d /var/lib/iptraf ]; then
		mkdir /var/lib/iptraf
	fi

	if [ -e /var/state/iptraf ]; then
		find /var/state/iptraf -mindepth 1 -maxdepth 1 	\
					-exec mv \{\} /var/lib/iptraf/ \;
		rmdir /var/state/iptraf || true
	fi

	# log files may have sensitive data
	test -d /var/log/iptraf || mkdir /var/log/iptraf
	chmod 0700 /var/log/iptraf

	# renaming old logfile rotator since it is marked as conffile and dpkg won't
	# remove it (reported as Bug#72998 by Josip Rodin <joy@cibalia.gkvk.hr>
	test -e /etc/cron.daily/iptraf && \
		mv /etc/cron.daily/iptraf /etc/cron.daily/iptraf.obsolete

	# filters changed in 3.0, move them away (copied from in src/install.sh)
	WORKDIR=/var/lib/iptraf/
	if [ -z "$2" ] || dpkg --compare-versions "$2" lt 3.0.0-1 ; then
		if [ -f $WORKDIR/tcpfilters.dat ]; then
			mv -f $WORKDIR/tcpfilters.dat $WORKDIR/tcpfilters.dat~
		fi

		if [ -f $WORKDIR/udpfilters.dat ]; then
			mv -f $WORKDIR/udpfilters.dat $WORKDIR/udpfilters.dat~
		fi

		if [ -f $WORKDIR/othipfilters.dat ]; then
			mv -f $WORKDIR/othipfilters.dat $WORKDIR/othipfilters.dat~
		fi

		rm -f $WORKDIR/savedfilters.dat
	fi
	;;

    abort-upgrade|abort-remove|abort-deconfigure)
        ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
        ;;
esac


#DEBHELPER#