File: whereami.dhclient3-exit-hook

package info (click to toggle)
whereami 0.3.37
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: sh: 1,094; perl: 524; makefile: 24
file content (33 lines) | stat: -rwxr-xr-x 841 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# dhcpv3 client script for whereami
# Chris Halls <chris.halls@gmx.de>
#
# Information about the lease is saved in
# /var/lib/whereami/dhclient3.<interface>, so
# subsequent invocations of whereami can use
# this information and whereami is started to
# determine whether the computer should be
# reconfigured

# Just exit if whereami is no longer installed
test ! -e /usr/sbin/whereami && exit 1

statefile=${STATEDIR:-"/var/lib/whereami"}/dhclient.$interface

# save state to file
{
    echo "# Generated by $0 - do not edit!"
    for I in reason new_ip_address alias_ip_address interface medium new_subnet_mask
      do
        eval echo "$I=\$$I"
    done
} > "$statefile"

# echo Reason:$reason
# cat $statefile

case "$reason" in
  REBOOT|BOUND)
	exec /usr/sbin/whereami --run_from dhclient --syslog --hint dhclient
	;;
esac