This file is indexed.

postinst is in exabgp 3.1.9-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
#!/bin/sh 

set -e

. /usr/share/debconf/confmodule
db_version 2.0

CONFIGFILE="/etc/exabgp/exabgp.env"
TMPCONF="/etc/exabgp/exabgp.env.dpkg-tmp"

gen_env_config() {
    echo "$1"
    trap 'rm -f $TMPCONF' TERM INT EXIT QUIT
    exabgp -fi >> "$TMPCONF" 2>/dev/null
    sed -i "s#nobody#exabgp#" "$TMPCONF"
    ucf --debconf-ok $TMPCONF $CONFIGFILE
    rm -f $TMPCONF
}

restore_user_settings() {
    if [ -f /etc/default/exabgp.dpkg-old ] ; then
	. /etc/default/exabgp.dpkg-old
	sed -i "s#EXABGPRUN=\"no#EXABGPRUN=\"$EXABGPRUN#" /etc/default/exabgp
    	sed -i "s#ETC=\"/etc/exabgp/#ETC=\"$ETC#" /etc/default/exabgp
    	sed -i "s#DAEMON_OPTS=\"/etc/exabgp/exabgp.conf#DAEMON_OPTS=\"$DAEMON_OPTS#" /etc/default/exabgp
    elif [ -f /etc/default/exabgp.dpkg-dist ] ; then
	. /etc/default/exabgp
	sed -i "s#EXABGPRUN=\"no#EXABGPRUN=\"$EXABGPRUN#" /etc/default/exabgp.dpkg-dist
    	sed -i "s#ETC=\"/etc/exabgp/#ETC=\"$ETC#" /etc/default/exabgp.dpkg-dist
    	sed -i "s#DAEMON_OPTS=\"/etc/exabgp/exabgp.conf#DAEMON_OPTS=\"$DAEMON_OPTS#" /etc/default/exabgp.dpkg-dist
    fi
}

if dpkg-maintscript-helper supports mv_conffile 2>/dev/null; then
    FILE_ONE="/etc/exabgp/processes/dynamic-1.sh"
    FILE_TWO="/etc/exabgp/processes/watchdog-1.sh"
    if ! egrep -q "$FILE_ONE" /etc/exabgp/exabgp.conf 2> /dev/null ; then dpkg-maintscript-helper rm_conffile "$FILE_ONE" -- "$@" ; fi
    if ! egrep -q "$FILE_TWO" /etc/exabgp/exabgp.conf 2> /dev/null ; then dpkg-maintscript-helper rm_conffile "$FILE_TWO" -- "$@" ; fi
    if [ -d "/etc/exabgp/processes/" ] ; then rmdir /etc/exabgp/processes || true 2>/dev/null ; fi 
fi

case "$1" in
configure)
    adduser --quiet --system --group --disabled-login --home /var/run/exabgp exabgp
    # The script will be started through the DEBHELPER script called hereunder.
    if [ ! -z "$2" ] ; then
	if  dpkg --compare-versions "$2" lt 3.0.0 ; then
		# Upgrade from an older version
		restore_user_settings
    		gen_env_config "ExaBGP: Migrating your old configuration data to the new file format."
		if [ -f /etc/default/exabgp.dpkg-dist ] ; then mv /etc/default/exabgp.dpkg-dist /etc/default/exabgp ; fi
	fi
    	if [ -e /var/run/exabgp/exabgp.pid ]; then invoke-rc.d exabgp stop ; fi
    else
	# First package installation
    	gen_env_config "ExaBGP: Generating the default configuration for environment variables (/etc/exabgp/exabgp.env)."
    fi
    ;;
esac


# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
	pycompile -p exabgp /usr/share/exabgp -V 2.6-
fi

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


# do this to avoid a <defunct> postinst (closing all FDs).
db_stop

exit 0