ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/Gateway/dhclient-exit-hooks
(Generate patch)

Comparing:
FreeBSDAdmin/DNS/update.sh (file contents), Revision 847 by douglas, 2006-08-03T18:06:23-07:00 vs.
FreeBSDAdmin/DNS/dhclient-exit-hooks.in (file contents), Revision 934 by douglas, 2007-07-03T20:12:54-07:00

# Line 1 | Line 1
1 < #!/usr/local/bin/bash
2 < # Update
1 > #!/bin/sh
2 > # DHCP Client Exit Hooks
3   #
4   # Douglas Thrift
5   #
6   # $Id$
7  
8 < read -e hostname interface name secret < ~/.update || exit $?
8 > %%key%%
9 > %%secret%%
10 > %%hostname%%
11  
12 < old=`host $hostname | sed -Ee "s/^$hostname has address ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$/\1/p;d"`
13 < address=`ifconfig $interface | sed -Ee 's/^     inet ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) netmask 0x[0-9a-f]{8} broadcast [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/\1/p;d'`
14 <
15 < if [[ $old != $address ]]; then
16 <        nsupdate <<-EOF
17 <        key $name $secret
18 <        update delete $hostname A
19 <        update add $hostname 3600 A $address
20 <        send
21 <        EOF
22 < fi
12 > case $reason in
13 > BOUND|RENEW|REBIND|REBOOT)
14 >        if [ "$old_ip_address" != "$new_ip_address" ]; then
15 >                nsupdate -d <<-EOF
16 >                key $key $secret
17 >                update delete $hostname A
18 >                update add $hostname 3600 A $new_ip_address
19 >                send
20 >                EOF
21 >        fi
22 >        ;;
23 > esac

Comparing:
FreeBSDAdmin/DNS/update.sh (property svn:executable), Revision 847 by douglas, 2006-08-03T18:06:23-07:00 vs.
FreeBSDAdmin/DNS/dhclient-exit-hooks.in (property svn:executable), Revision 934 by douglas, 2007-07-03T20:12:54-07:00

# Line 1 | Line 0
1 *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines