This file is indexed.

postinst is in fwknop-server 2.6.0-2.

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
83
84
85
86
87
88
89
90
91
92
#!/bin/sh

set -e

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

#
# 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

    # Set configuration files
    CONF_FILE="/etc/fwknop/fwknopd.conf"
    ACCESS_FILE="/etc/fwknop/access.conf"
    DEFAULT_FILE="/etc/default/fwknop-server"

    START_DAEMON="no"

    # Check for the easy setup
    #db_get fwknop-server/easy_setup || true
    #EASY_SETUP=$RET
    EASY_SETUP="false"

    # Update configuration file for easy setup according to the user choices
    if [ "$EASY_SETUP" = "true" ]; then 

        # Get the sniffing interface
        db_get fwknop-server/pcap_iface
        update_conf "$RET" "PCAP_INTF" "$CONF_FILE"

        # Get the encryption key
        db_get fwknop-server/key
        update_conf "$RET" "KEY:" "$ACCESS_FILE"

        # Set whether the daemon should be run at boot time or not
        # and update $DEFAULT_FILE
        cp $DEFAULT_FILE $DEFAULT_FILE.old
        sed "s/START_DAEMON=.*/START_DAEMON=\"yes\"/" < $DEFAULT_FILE.old > $DEFAULT_FILE
        rm -f $DEFAULT_FILE.old
    fi

    # Stop po-debconf
    db_stop

fi

# Automatically added by dh_installinit
if [ -x "/etc/init.d/fwknop-server" ] || [ -e "/etc/init/fwknop-server.conf" ]; then
	if [ ! -e "/etc/init/fwknop-server.conf" ]; then
		update-rc.d fwknop-server defaults >/dev/null
	fi
	invoke-rc.d fwknop-server start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f fwknop-server remove >/dev/null || exit $?
# End automatically added section


exit 0;