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

schweer-guest at alioth.debian.org schweer-guest at alioth.debian.org
Fri May 10 16:34:16 UTC 2013


Author: schweer-guest
Date: 2013-05-10 16:34:15 +0000 (Fri, 10 May 2013)
New Revision: 80045

Added:
   branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname
Modified:
   branches/wheezy/debian-edu-config/debian/changelog
Log:
Add script /etc/dhcp/dhclient-exit-hooks.d/hostname, which will
set the client's hostname.

Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog	2013-05-10 09:46:23 UTC (rev 80044)
+++ branches/wheezy/debian-edu-config/debian/changelog	2013-05-10 16:34:15 UTC (rev 80045)
@@ -23,6 +23,8 @@
     possible problems, that might occur, if someone installs several
     desktop environments. The package gosa-desktop now provides the
     same menu entry for KDE, GNOME and LXDE.
+  * Add script /etc/dhcp/dhclient-exit-hooks.d/hostname, which will
+    set the client's hostname.
 
  -- Petter Reinholdtsen <pere at debian.org>  Wed, 08 May 2013 11:17:25 +0200
 

Added: branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname
===================================================================
--- branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname	                        (rev 0)
+++ branches/wheezy/debian-edu-config/etc/dhcp/dhclient-exit-hooks.d/hostname	2013-05-10 16:34:15 UTC (rev 80045)
@@ -0,0 +1,20 @@
+OD#!/bin/sh
+#
+# Purpose: Used by dhclient-script to set the hostname of the system
+# to match the DNS information for the host as provided by DHCP.
+#
+# This script was found on the web:
+# http://www.debian-administration.org/articles/447 and
+# http://nxhelp.com/blog/2013/01/24/automatically-set-hostname-from-dhcp/
+#
+if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
+ && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ]
+then
+  return
+fi
+echo dhclient-exit-hooks.d/hostname: Dynamic IP address = $new_ip_address
+hostname=$(host $new_ip_address | cut -d ' ' -f 5 | cut -d '.' -f 1)
+echo $hostname > /etc/hostname
+hostname $hostname
+echo dhclient-exit-hooks.d/hostname: Dynamic Hostname = $hostname
+




More information about the debian-edu-commits mailing list