[pkg-dhcp-commits] [SCM] ISC DHCP packaging for Debian branch, master, updated. debian/4.1.1-P1-16.1-28-gd051736
Andrew Pollock
apollock at debian.org
Sat Aug 27 20:36:10 UTC 2011
The following commit has been merged in the master branch:
commit d0517364e6494c895e8b25b1ff46f8ef12bb51d0
Author: Andrew Pollock <apollock at debian.org>
Date: Sat Aug 27 13:34:17 2011 -0700
isc-dhcpd-server.init.d overhaul
Patches from Peter Marschall to:
isc-dhcp-server.init.d: read pid file from config file
If not already set in /etc/default/isc-dhcp-server, try to read the
pid filename to use from the DHCP deamon's config directive 'pid-file-name'
in the dhcpd.conf file.
Fall back to default /var/run/dhcpd.pid if it is still empty then.
Quote the variable on every use.
Use a variable for /etc/default/isc-dhcp-server in order to have to change
the name only in one place, should the name of this file change.
Allow setting this variable from the calling environment, and fall back to
/etc/default/isc-dhcp-server.
Allow setting the variable DHCPD_CONF in the defaults file
/etc/default/isc-dhcp-server.
Fall back to /etc/dhcp/dhcpd.conf if it is not given there
Use variable OPTIONS in calls to dhcpd.
diff --git a/debian/changelog b/debian/changelog
index 3eed356..0445c5d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,10 +15,16 @@ isc-dhcp (4.2.2-1) unstable; urgency=low
* Apply patch from Peter Marschall to split the rfc3442-classless-routes hook
into a Linux and a kFreeBSD variant, so that the Linux one can use iproute
(closes: #630519)
- * debian/isc-dhcp-server.postinst: apply patch from Peter Marshall to
+ * debian/isc-dhcp-server.postinst: apply patch from Peter Marschall to
document new variables in /etc/default/isc-dhcp-server
-
- -- Andrew Pollock <apollock at debian.org> Sat, 27 Aug 2011 13:14:05 -0700
+ * debian/isc-dhcp-server.init.d: apply patch from Peter Marschall to
+ - make the name of the default file configurable
+ - make the name of the server configuration file configurable (closes:
+ #590158, #565650)
+ - allow passing additional options to dhcpd (closes: #613734)
+ - read PID from config file
+
+ -- Andrew Pollock <apollock at debian.org> Sat, 27 Aug 2011 13:26:35 -0700
isc-dhcp (4.1.1-P1-18) unstable; urgency=low
diff --git a/debian/isc-dhcp-server.init.d b/debian/isc-dhcp-server.init.d
index 83a30da..5ca732a 100644
--- a/debian/isc-dhcp-server.init.d
+++ b/debian/isc-dhcp-server.init.d
@@ -18,29 +18,38 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
test -f /usr/sbin/dhcpd || exit 0
+DHCPD_DEFAULT=${DHCPD_DEFAULT:-/etc/default/isc-dhcp-server}
+
# It is not safe to start if we don't have a default configuration...
-if [ ! -f /etc/default/isc-dhcp-server ]; then
- echo "/etc/default/isc-dhcp-server does not exist! - Aborting..."
- echo "Run 'dpkg-reconfigure isc-dhcp-server' to fix the problem."
+if [ ! -f "$DHCPD_DEFAULT" ]; then
+ echo "$DHCPD_DEFAULT does not exist! - Aborting..."
+ if [ "$DHCPD_DEFAULT" = "/etc/default/isc-dhcp-server" ]; then
+ echo "Run 'dpkg-reconfigure isc-dhcp-server' to fix the problem."
+ fi
exit 0
fi
. /lib/lsb/init-functions
-# Read init script configuration (so far only interfaces the daemon
-# should listen on.)
-[ -f /etc/default/isc-dhcp-server ] && . /etc/default/isc-dhcp-server
+# Read init script configuration
+[ -f "$DHCPD_DEFAULT" ] && . "$DHCPD_DEFAULT"
NAME=dhcpd
DESC="ISC DHCP server"
-DHCPDPID=/var/run/dhcpd.pid
+# fallback to default config file
+DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
+# try to read pid file name from config file, with fallback to /var/run/dhcpd.pid
+if [ -z "$DHCPD_PID" ]; then
+ DHCPD_PID=$(sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p' < "$DHCPD_CONF" | head -n 1)
+fi
+DHCPD_PID="${DHCPD_PID:-/var/run/dhcpd.pid}"
test_config()
{
- if ! /usr/sbin/dhcpd -t -q > /dev/null 2>&1; then
- echo "dhcpd self-test failed. Please fix the config file."
+ if ! /usr/sbin/dhcpd -t $OPTIONS -q -cf "$DHCPD_CONF" > /dev/null 2>&1; then
+ echo "dhcpd self-test failed. Please fix $DHCPD_CONF."
echo "The error was: "
- /usr/sbin/dhcpd -t
+ /usr/sbin/dhcpd -t $OPTIONS -cf "$DHCPD_CONF"
exit 1
fi
}
@@ -48,15 +57,15 @@ test_config()
# single arg is -v for messages, -q for none
check_status()
{
- if [ ! -r "$DHCPDPID" ]; then
+ if [ ! -r "$DHCPD_PID" ]; then
test "$1" != -v || echo "$NAME is not running."
return 3
fi
- if read pid < "$DHCPDPID" && ps -p "$pid" > /dev/null 2>&1; then
+ if read pid < "$DHCPD_PID" && ps -p "$pid" > /dev/null 2>&1; then
test "$1" != -v || echo "$NAME is running."
return 0
else
- test "$1" != -v || echo "$NAME is not running but $DHCPDPID exists."
+ test "$1" != -v || echo "$NAME is not running but $DHCPD_PID exists."
return 1
fi
}
@@ -65,8 +74,9 @@ case "$1" in
start)
test_config
log_daemon_msg "Starting $DESC" "$NAME"
- start-stop-daemon --start --quiet --pidfile $DHCPDPID \
- --exec /usr/sbin/dhcpd -- -q $INTERFACES
+ start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \
+ --exec /usr/sbin/dhcpd -- \
+ -q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES
sleep 2
if check_status -q; then
@@ -79,9 +89,9 @@ case "$1" in
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
- start-stop-daemon --stop --quiet --pidfile $DHCPDPID
+ start-stop-daemon --stop --quiet --pidfile "$DHCPD_PID"
log_end_msg $?
- rm -f "$DHCPDPID"
+ rm -f "$DHCPD_PID"
;;
restart | force-reload)
test_config
--
ISC DHCP packaging for Debian
More information about the pkg-dhcp-commits
mailing list