This file is indexed.

preinst is in psad 2.2.3-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
#!/bin/sh

#
# Update_conf
#
# This function searchs a key entry in a file and updates its value with the new
# one.
#
# Syntax:
#
#    update_conf new_val key conffile
#      -> new_val ... : Value to set for the key value
#      -> key ....... : Name of the key to be updated
#      -> conffile .. : File to search
#
update_conf ()
{
        local new_val
        local key
        local conffile

        new_val=$1
        key=$2
        conffile=$3

        cp $conffile $conffile.old

        old_val=`awk '$1 == "'$key'" { print $2 }' $conffile`
        awk '$1 == "'$key'" { gsub("'$old_val'","'$new_val';",$0); \
                           print $0 } \
                 $1 != "'$key'" { print $0 }' \
                 $conffile.old > $conffile

        rm $conffile.old
}

if [ "$1" = "upgrade" -o "$1" = "install" ]; then

    # Revert changes added to the configuration file by the postinst script
    # if we are upgrading from a version which changed it (#688891)
    # or if we are installed with a prior version (#675231)
    if [ -n "$2" ] && dpkg --compare-versions 2.2-3 gt $2 ; then
        update_conf "_CHANGEME_" "HOSTNAME" "/etc/psad/psad.conf"
    fi

fi

if [ "$1" = "upgrade" ]; then

    # This script is only intended to fix bug #497574.
    # We check for an upgrade from Psad older than 2.1.5 and remove the old
    # Psad process if needed.
    #
    # NB: As some commands can return an exit code other than 0 we do not use
    # *set -e* at the beginning.

    status=1;
    if [ -x "`which dpkg 2>/dev/null`" ]; then 
        dpkg --compare-versions 2.1.5 gt $2
        status=$?
    fi

    if [ $status = 0 ]; then

        echo -n "Removing old Psad process ... "

        process_list="psadwatchd kmsgsd psad"
        for process in $process_list; do
	    pkill $process 2>/dev/null
        done

        echo "Done."

    fi

fi

set -e



exit 0