File: logcheck-database.preinst

package info (click to toggle)
logcheck 1.2.54
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,372 kB
  • ctags: 54
  • sloc: sh: 872; python: 158; perl: 138; makefile: 136
file content (88 lines) | stat: -rw-r--r-- 2,494 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
# postinst script for logcheck-database
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# Source debconf library.
#. /usr/share/debconf/confmodule

# File removed from the package.
rmfiles="ignore.d.workstation/dhclient ignore.d.workstation/dhcp"

workstation="automount bind cron dhcp exim imap imp ipppd isdnutils oidentd \
             portsentry postfix proftpd qmail qpopper samba squid stunnel \
             sysklogd telnetd uptimed"

server="cron exim portsentry ppp qmail qpopper squid sysklogd telnetd"

ruledirs="cracking.d ignore.d.workstation ignore.d.server ignore.d.paranoid \
          violations.d violations.ignore.d"

confdir="/etc/logcheck"

case "$1" in
    install|upgrade)
	# upgrading 
	if [ -n "$2" ]; then
	    # The standard files were renamed in 1.2.1 release, so
	    # we'll move it to the new name.
	    if dpkg --compare-versions "$2" lt "1.2.1"; then
		echo -n "Copying standard files to logcheck: "
		for dir in $ruledirs; do
		    if [ -f $confdir/$dir/standard ]; then
			echo -n "$dir, "
			mv $confdir/$dir/standard $confdir/$dir/logcheck
		    fi
		done
		echo 
		echo -n "Renaming violations.ignore.d/standard.postfix to logcheck-postfix: "
		if [ -f $confdir/violations.ignore.d/standard.postfix ]; then 
		    mv $confdir/violations.ignore.d/standard.postfix \
			$confdir/violations.ignore.d/logcheck-postfix
		fi
		echo "Done"
	    fi

            # Rename violations.ignore.d/innd was renamed to 
	    # violations.ignore.d/logcheck-innd in release 1.2.7
	    if dpkg --compare-versions "$2" lt "1.2.7"; then
		if [ -f $confdir/violations.ignore.d/innd ]; then
		    echo -n "Renaming $confdir/violations.ignore.d/innd: "
		    if [ -f $confdir/violations.ignore.d/logcheck-innd ]; then
			echo "Failed - target file exists"
		    else
			mv $confdir/violations.ignore.d/innd \
			    $confdir/violations.ignore.d/logcheck-innd
			echo "Done"
		    fi
		fi
	    fi
	fi
	;;
    
    abort-upgrade)
	;;
    
    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0