postinst is in psad 2.1.7-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 | #! /bin/sh
set -e
#
# 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" = "configure" ]; then
NAME=`hostname`
update_conf "$NAME" "HOSTNAME" "/etc/psad/psad.conf"
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/psad" ]; then
update-rc.d psad defaults >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d psad start || exit $?
else
/etc/init.d/psad start || exit $?
fi
fi
# End automatically added section
exit 0
|