This file is indexed.

postinst is in dhcp-probe 1.3.0-10ubuntu1.

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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#!/bin/sh
# piston's script for dhcp-probe
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


PACKAGE="dhcp-probe"
CONF_DIR="/etc/$PACKAGE"
CONF_FILE="/etc/dhcp_probe.cf"

MSG="dhcp-probe: IP not configured on host, please see template file"
MSG="$MSG /usr/share/doc/dhcp-probe/dhcp_probe.tpl.eth0 to configure !"

#
# Dynamic configuration procedure
#
if test -f /lib/lsb/init-functions
then
	. /lib/lsb/init-functions
fi

#
# postinst script main
#
case "$1" in
    configure)
			IFCONFIG='/sbin/ifconfig'
			DEST="/etc/$PACKAGE/$PACKAGE"
			NB_FILE=`ls -1 "$CONF_DIR" | wc -l`
			if test "$NB_FILE"="0" 
			then # Configuration doesn't exist
				interfaces=`$IFCONFIG | grep Ethernet | awk '{ print $1 }';`
				if test -n "$interfaces"
				then
					for i in $interfaces; do
						ether=`$IFCONFIG | grep -e "^$i" | awk '{ print $5 }';`
						eth_lines=`$IFCONFIG | grep -A 3 $i`
						inet=`echo $eth_lines | awk '{ print $6 }';`
						if test $inet = 'inet'
						then
							ipv4=`echo $eth_lines | awk '{ print $7 }' | awk -F: '{ print $2 }'`                                          
			        ipv4_mask=`echo $eth_lines | awk '{ print $8 }' | awk -F: '{ print $2 }'`
							TMPDEST=`mktemp -t $PACKAGE.XXXXXXXX`
							echo "#" > "$TMPDEST.$i"
							echo "# Automaticaly generated file during dhcp-probe package install procedure" >> "$TMPDEST.$i"
							echo "#" >> "$TMPDEST.$i"
							echo "INTERFACE=\"$i\"" >> "$TMPDEST.$i"
							echo "MAC=\"$ether\"" >> "$TMPDEST.$i"
							echo "IPV4=\"$ipv4\"" >> "$TMPDEST.$i"
							echo "IPV4_MASK=\"$ipv4_mask\"" >> "$TMPDEST.$i"
							ucf "$TMPDEST.$i" "$DEST.$i"
							logger -i -p daemon.crit "$TMPDEST.$i installed."
							rm -f $TMPDEST
						else
							echo "IP V4 isn't configured on interface $i !" | tee | logger -i -p daemon.crit
						fi
						ether=""
						eth_lines=""
					done
				fi
			fi
			DHCP_PROBE_CF=`mktemp -t $PACKAGE.XXXXXXXX`
			if test ! -f "$CONF_FILE"; then
				ucf "$DHCP_PROBE_CF" "$CONF_FILE"
			fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac



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


exit 0