3 # $1 Calling circumstance (up, renewal, down)
7 # Exit early, if we're not being called for the initial lease
8 [ "$1" != "up" ] && exit 0
10 # See if we're needed at all, only run when booted with dhcphostname
11 for i in $(cat /proc/cmdline)
13 if [ "$i" = "dhcphostname" ]
15 # dhcphostname is set, get the PTR for the ip
16 hostname=$(host $3 | awk '{ print substr($5, 0, length($5)-1) }')
19 echo $hostname > /etc/hostname