philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/README.dhclient.d

c8bb8f
The /etc/dhcp/dhclient.d directory allows other packages and system
c8bb8f
administrators to create application-specific option handlers for dhclient.
c8bb8f
c8bb8f
When dhclient is run, any option listed in the dhcp-options(5) man page can
c8bb8f
be requested.  dhclient-script does not handle every option available
c8bb8f
because doing so would make the script unmaintainable as the components
c8bb8f
using those options might change over time.  The knowledge of how to handle
c8bb8f
those options should be under the responsibility of the package maintainer
c8bb8f
for that component (e.g., NTP options belong in a handler in the ntp
c8bb8f
package).
c8bb8f
c8bb8f
To make maintenance easier, application specific DHCP options can be handled
c8bb8f
by creating a script with two functions and placing it in /etc/dhcp/dhclient.d
c8bb8f
c8bb8f
The script must follow a specific form:
c8bb8f
c8bb8f
(1) The script must be named NAME.sh.  NAME can be anything, but it makes
c8bb8f
    sense to name it for the service it handles.  e.g., ntp.sh
c8bb8f
c8bb8f
(2) The script must provide a NAME_config() function to read the options and
c8bb8f
    do whatever it takes to put those options in place.
c8bb8f
c8bb8f
(3) The script must provide a NAME_restore() function to restore original
c8bb8f
    configuration state when dhclient stops.
c8bb8f
c8bb8f
(4) The script must be 'chmod +x' or dhclient-script will ignore it.
c8bb8f
c8bb8f
The scripts execute in the same environment as dhclient-script.  That means
c8bb8f
all of the functions and variables available to it are available to your
c8bb8f
NAME.sh script.  Things of note:
c8bb8f
c8bb8f
    ${SAVEDIR} is where original configuration files are saved.  Save your
c8bb8f
    original configuration files here before you take the DHCP provided
c8bb8f
    values and generate new files.
c8bb8f
c8bb8f
    Variables set in /etc/sysconfig/network, /etc/sysconfig/networking/network,
c8bb8f
    and /etc/sysconfig/network-scripts/ifcfg-$interface are available to
c8bb8f
    you.
c8bb8f
c8bb8f
See the scripts in /etc/dhcp/dhclient.d for examples.
c8bb8f
c8bb8f
NOTE:  Do not use functions defined in /usr/sbin/dhclient-script.  Consider
c8bb8f
dhclient-script a black box.  This script may change over time, so the
c8bb8f
dhclient.d scripts should not be using functions defined in it.
c8bb8f
c8bb8f
-- 
c8bb8f
David Cantrell <dcantrell@redhat.com>