[debian-edu-commits] r81182 - in branches/wheezy/debian-edu-config: debian etc/dhcp/dhclient-exit-hooks.d

pere at alioth.debian.org pere at alioth.debian.org
Wed Jun 26 07:43:16 UTC 2013


Author: pere
Date: 2013-06-26 07:43:16 +0000 (Wed, 26 Jun 2013)
New Revision: 81182

Modified:
   branches/wheezy/debian-edu-config/debian/changelog
   branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname
Log:
* Adjusted DHCP hook to set hostname, to make sure it set FQDN and
  not the short name, to make sure Kerberos know which domain to use
  to find the realm and the Kerberos server.
* Made DHCP hook to set hostname more robust.

Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog	2013-06-25 20:24:00 UTC (rev 81181)
+++ branches/wheezy/debian-edu-config/debian/changelog	2013-06-26 07:43:16 UTC (rev 81182)
@@ -1,3 +1,13 @@
+debian-edu-config (1.708~svn81169) UNRELEASED; urgency=low
+
+  [ Petter Reinholdtsen ]
+  * Adjusted DHCP hook to set hostname, to make sure it set FQDN and
+    not the short name, to make sure Kerberos know which domain to use
+    to find the realm and the Kerberos server.
+  * Made DHCP hook to set hostname more robust.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Wed, 26 Jun 2013 09:38:43 +0200
+
 debian-edu-config (1.708~svn81168) wheezy-test; urgency=low
 
   [ Petter Reinholdtsen ]

Modified: branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname
===================================================================
--- branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname	2013-06-25 20:24:00 UTC (rev 81181)
+++ branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname	2013-06-26 07:43:16 UTC (rev 81182)
@@ -21,10 +21,20 @@
 else
 	exit 0
 fi
+
+# Map IP to FQDN
+ip2hostname() {
+    ip=$1
+    host $new_ip_address | grep 'domain name pointer' | cut -d ' ' -f 5 | \
+	rev |cut -d '.' -f 2-|rev
+}
+
 case "$reason" in
 	BOUND|RENEW|REBIND|REBOOT)
-	hostname=$(host $new_ip_address | grep 'domain name pointer' | cut -d ' ' -f 5 | cut -d '.' -f 1)
-	if [ "$hostname" != "$(uname -n)" ] ; then
+	hostname=$(ip2hostname $new_ip_address)
+	if [ -z "$hostname" ] ; then
+		logger -t dhclient-exit-hooks.d/hostname "unable to find hostname from DHCP IP address $new_ip_address, not updating current hostname"
+	elif [ "$hostname" != "$(uname -n)" ] ; then
 		echo dhclient-exit-hooks.d/hostname: Dynamic IP address = $new_ip_address
 		echo $hostname > /etc/hostname
 		hostname $hostname




More information about the debian-edu-commits mailing list