From d6790d5a5c773531c02617d4b3a3b0af510754d4 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 8 Jun 2005 18:21:56 +0000 Subject: [PATCH] Add support for /etc/dhclient-exit-hooks file. Tested by: Max Boyarov --- sbin/dhclient/dhclient-script | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index 2d267f33d18b..46974fbe0fd9 100644 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -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