Re: dhclient-exit-hooks

From: Brooks Davis <brooks_at_one-eyed-alien.net>
Date: Wed, 8 Jun 2005 10:39:13 -0700
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
_at__at_ -172,6 +172,16 _at__at_ 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.
 #
_at__at_ -247,14 +257,14 _at__at_ 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

Received on Wed Jun 08 2005 - 15:39:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:36 UTC