it's kind of hackish, but it wouldn't be too hard to patch the init
script to generate dhcpd.conf on startup by copying
/etc/dhcp3/dhcpd.conf somewhere (/var/run ?) and adding one include
entry for each file found in /etc/dhcp3/dhcpd.conf.d/
each call to /usr/sbin/dhcpd3 in the init script would have to be
patched to use the -cf option...
(untested) patch for /etc/init.d/dhcp3-server attached.
live well,
vagrant
--- dhcp3-server.orig 2008-02-10 13:56:42.000000000 -0800
+++ dhcp3-server 2008-03-01 00:47:05.000000000 -0800
@@ -26,20 +26,34 @@
exit 0
fi
+CONFIG_FILE=/etc/dhcp3/dhcpd.conf
+
# Read init script configuration (so far only interfaces the daemon
# should listen on.)
. /etc/default/dhcp3-server
+if [ -n "$CONFIG_FILE" ] && [ -d "$CONFIG_FILE".d ]; then
+ CONFIG_SNIPPETS=$(run-parts --list "$CONFIG_FILE".d)
+ if [ -n "$CONFIG_SNIPPETS" ]; then
+ OLD_CONFIG_FILE=$CONFIG_FILE
+ CONFIG_FILE=/var/run/dhcpd.conf
+ cp $OLD_CONFIG_FILE $CONFIG_FILE
+ for x in $CONFIG_SNIPPETS ; do
+ echo include \"$x\"\; >> $CONFIG_FILE
+ done
+ fi
+fi
+
NAME=dhcpd3
DESC="DHCP server"
DHCPDPID=/var/run/dhcpd.pid
test_config()
{
- if ! /usr/sbin/dhcpd3 -t > /dev/null 2>&1; then
+ if ! /usr/sbin/dhcpd3 -t -cf $CONFIG_FILE > /dev/null 2>&1; then
echo "dhcpd self-test failed. Please fix the config file."
echo "The error was: "
- /usr/sbin/dhcpd3 -t
+ /usr/sbin/dhcpd3 -t -cf $CONFIG_FILE
exit 1
fi
}
@@ -65,7 +79,7 @@
test_config
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile $DHCPDPID \
- --exec /usr/sbin/dhcpd3 -- -q $INTERFACES
+ --exec /usr/sbin/dhcpd3 -- -q $INTERFACES -cf $CONFIG_FILE
sleep 2
if check_status -q; then