PERFORCE change 66281 for review

Sam Leffler sam at FreeBSD.org
Thu Dec 2 14:50:27 PST 2004


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

Change 66281 by sam at 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


More information about the p4-projects mailing list