dhclient-exit-hooks

Brooks Davis brooks at one-eyed-alien.net
Wed Jun 8 17:39:16 GMT 2005


On Wed, Jun 08, 2005 at 04:20:02PM +0300, Max Boyarov wrote:
> 
> After last upgrade to current my dhclient-exit-hooks don't work.
> I checked my configuration again, but I cant found any place in
> /sbin/dhclient-script that runs hooks. How can I now use
> dhclient-exit-hooks ?

We need to add support for exit hooks back to the script.a  I think this
should do it:

Index: sbin/dhclient/dhclient-script
===================================================================
RCS file: /home/ncvs/src/sbin/dhclient/dhclient-script,v
retrieving revision 1.2
diff -u -p -r1.2 dhclient-script
--- sbin/dhclient/dhclient-script	7 Jun 2005 04:32:29 -0000	1.2
+++ sbin/dhclient/dhclient-script	8 Jun 2005 17:34:34 -0000
@@ -172,6 +172,16 @@ add_new_resolv_conf() {
 	return 1
 }
 
+# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
+exit_with_hooks() {
+	exit_status=$1
+	if [ -f /etc/dhclient-exit-hooks ]; then
+		. /etc/dhclient-exit-hooks
+	fi
+	# probably should do something with exit status of the local script
+	exit $exit_status
+}
+
 #
 # Start of active code.
 #
@@ -247,14 +257,14 @@ TIMEOUT)
 			fi
 			add_new_routes
 			if add_new_resolv_conf; then
-				exit 0
+				exit_with_hooks 0
 			fi
 		fi
 	fi
 	ifconfig $interface inet -alias $new_ip_address $medium
 	delete_old_routes
-	exit 1
+	exit_with_hooks 1
 	;;
 esac
 
-exit 0
+exit_with_hooks 0


-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050608/72097eac/attachment.bin


More information about the freebsd-current mailing list