Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 2004 22:50:26 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 66281 for review
Message-ID:  <200412022250.iB2MoQF1012728@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help

http://perforce.freebsd.org/chv.cgi?CH=66281

Change 66281 by sam@sam_ebb on 2004/12/02 22:49:59

	more stuff from old script:
	o don't clobber default route when adding a new address; this
	  maintains old behaviour
	o set hostname if we're supplied a name

Affected files ...

.. //depot/projects/wifi/sbin/dhclient/dhclient-script#4 edit

Differences ...

==== //depot/projects/wifi/sbin/dhclient/dhclient-script#4 (text+ko) ====

@@ -32,6 +32,18 @@
 # Helper functions that implement common actions.
 #
 
+check_hostname() {
+	current_hostname=`$HOSTNAME`
+	if [ -z "$current_hostname" ]; then
+		$LOGGER "New Hostname: $new_host_name"
+		$HOSTNAME $new_host_name
+	elif [ "$current_hostname" = "$old_host_name" -a \
+	       "$new_host_name" != "$old_host_name" ]; then
+		$LOGGER "New Hostname: $new_host_name"
+		$HOSTNAME $new_host_name
+	fi
+}
+
 delete_old_address() {
 	if [ -n "$old_ip_address" ]; then
 		ifconfig $interface inet -alias $old_ip_address $medium
@@ -86,7 +98,6 @@
 }
 
 add_new_routes() {
-	route delete default >/dev/null 2>&1
 	for router in $new_routers; do
 		if [ "$new_ip_address" = "$router" ]; then
 			route add default -iface $router >/dev/null 2>&1
@@ -185,6 +196,7 @@
 	;;
 
 BOUND|RENEW|REBIND|REBOOT)
+	check_hostname
 	if [ -n "$old_ip_address" ]; then
 		if [ "$old_ip_address" != "$alias_ip_address" ]; then
 			delete_old_alias



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412022250.iB2MoQF1012728>