rpms/dhcp/devel dhcp.spec, 1.170, 1.171 dhcpd.init, 1.16, 1.17 dhcrelay.init, 1.3, 1.4
David Cantrell (dcantrel)
fedora-extras-commits at redhat.com
Wed Sep 26 19:21:20 UTC 2007
Author: dcantrel
Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26797
Modified Files:
dhcp.spec dhcpd.init dhcrelay.init
Log Message:
* Wed Sep 26 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.6-6
- Init script fixes for dhcpd and dhcrelay (#278601)
Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -r1.170 -r1.171
--- dhcp.spec 10 Sep 2007 15:06:40 -0000 1.170
+++ dhcp.spec 26 Sep 2007 19:20:47 -0000 1.171
@@ -13,7 +13,7 @@
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
Name: dhcp
Version: 3.0.6
-Release: 5%{?dist}
+Release: 6%{?dist}
Epoch: 12
License: ISC
Group: System Environment/Daemons
@@ -431,6 +431,9 @@
%{_libdir}/libdhcp4client.a
%changelog
+* Wed Sep 26 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.6-6
+- Init script fixes for dhcpd and dhcrelay (#278601)
+
* Mon Sep 10 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.6-5
- Fix typos in ldap.c and correct LDAP macros (#283391)
Index: dhcpd.init
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcpd.init,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- dhcpd.init 10 Jul 2007 18:59:53 -0000 1.16
+++ dhcpd.init 26 Sep 2007 19:20:47 -0000 1.17
@@ -1,37 +1,54 @@
-#!/bin/bash
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: dhcpd
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Should-Start:
+# Required-Start: $network
+# Required-Stop:
+# Short-Description: Start and stop the DHCP server
+# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
+# server.
+### END INIT INFO
+#
+# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
-# description: dhcpd provide access to Dynamic Host Control Protocol.
+# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
+# server
+# processname: dhcpd
+# config: /etc/dhcpd.conf
+# config: /var/lib/dhcpd/dhcpd.leases
+# pidfile: /var/run/dhcpd.pid
-# Source function library.
. /etc/init.d/functions
RETVAL=0
+
prog=dhcpd
dhcpd=/usr/sbin/dhcpd
lockfile=/var/lock/subsys/dhcpd
+pidfile=/var/run/dhcpd.pid
-. /etc/sysconfig/dhcpd
+[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
-cfOption() {
- let i=0
- for a in $* ; do
- ((++i))
- if [ $a = -cf ]; then
- ((++i))
- eval 'echo $'$i
- elif [[ $a = -cf* ]]; then
- echo ${a#-cf}
+# if the user specified a different config file, make sure we reference it
+findConfig() {
+ for arg in $DHCPDARGS ; do
+ if [ $found = 1 ]; then
+ [ -f "$arg" ] && echo "$arg"
+ return
+ fi
+ if [ "$arg" = "-cf" ]; then
+ found=1
+ continue
fi
done
+ echo "/etc/dhcpd.conf"
}
-CF=`cfOption $DHCPDARGS`
-if [ -z "$CF" ]; then
- CF='/etc/dhcpd.conf'
-fi
-
-[ -f "$CF" ] || exit 0
+conf="$(findConfig "$DHCPDARGS")"
if [ ! -f /var/lib/dhcpd/dhcpd.leases ] ; then
mkdir -p /var/lib/dhcpd
@@ -41,15 +58,20 @@
configtest() {
[ -x $dhcpd ] || return 5
- [ -f $CF ] || return 6
- $dhcpd -q -t -cf $CF
+ [ -f $conf ] || return 6
+ $dhcpd -q -t -cf $conf
RETVAL=$?
return $RETVAL
}
start() {
[ -x $dhcpd ] || return 5
- [ -f $CF ] || return 6
+ [ -f $conf ] || return 6
+
+ pidofproc $prog >/dev/null 2>&1
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && return $RETVAL
+
echo -n $"Starting $prog: "
daemon $dhcpd $DHCPDARGS 2>/dev/null
RETVAL=$?
@@ -59,42 +81,60 @@
}
stop() {
+ pidofproc $prog >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ RETVAL=7
+ return $RETVAL
+ fi
+
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
+
+ [ $RETVAL = 0 ] && success || failure
echo
[ $RETVAL = 0 ] && rm -f $lockfile
return $RETVAL
}
-# See how we were called.
+if [ ! -x $dhcdbd ]; then
+ RETVAL=5
+ exit $RETVAL
+fi
+
+if [ $# -gt 1 ]; then
+ RETVAL=2
+ exit $RETVAL
+fi
+
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
- reload)
- RETVAL=3
+ restart|force-reload)
+ stop && start
+ RETVAL=$?
;;
- restart)
- configtest || exit $?
- stop
- start
+ try-restart|reload)
+ RETVAL=3
;;
condrestart)
if [ -f $lockfile ]; then
- stop
- start
+ stop && start
+ RETVAL=$?
fi
;;
- configtest|check|testconfig|test)
+ configtest)
configtest
RETVAL=$?
;;
status)
- status $prog
+ status $dhcpd
RETVAL=$?
;;
*)
Index: dhcrelay.init
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcrelay.init,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dhcrelay.init 26 Apr 2007 19:01:43 -0000 1.3
+++ dhcrelay.init 26 Sep 2007 19:20:47 -0000 1.4
@@ -1,23 +1,58 @@
-#!/bin/bash
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: dhcrelay
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Should-Start:
+# Required-Start: $network
+# Required-Stop:
+# Short-Description: Start and stop the DHCP relay server
+# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
+# relay server. This is required when your DHCP server is on
+# another network segment from the clients.
+### END INIT INFO
+#
+# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 66 34
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
+# processname: dhcrelay
+# # pidfile: /var/run/dhcrelay.pid
-# Source function library
. /etc/init.d/functions
RETVAL=0
+
prog=dhcrelay
dhcrelay=/usr/sbin/dhcrelay
lockfile=/var/lock/subsys/dhcrelay
+pidfile=/var/run/dhcrelay.pid
+conf=/etc/sysconfig/dhcrelay
-start() {
+# The dhcrelay daemon uses the sysconfig file for configuration information.
+# There is no native configuration file for this program and you must specify
+# its settings on the command line.
+[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
+
+configtest() {
[ -x $dhcrelay ] || exit 5
- [ -f /etc/sysconfig/dhcrelay ] || exit 6
- . /etc/sysconfig/dhcrelay
+ [ -f $conf ] || exit 6
[ -z "$DHCPSERVERS" ] && exit 6
+ RETVAL=0
+ return $RETVAL
+}
+
+start() {
+ [ -x $dhcrelay ] || exit 5
+ [ -f $conf ] || exit 6
+
+ pidofproc $prog >/dev/null 2>&1
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && return $RETVAL
+
echo -n $"Starting $prog: "
- daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS
+ daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS 2>/dev/null
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
@@ -25,41 +60,64 @@
}
stop() {
+ pidofproc $prog >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ RETVAL=7
+ return $RETVAL
+ fi
+
echo -n $"Shutting down $prog: "
killproc $prog -TERM
RETVAL=$?
+
+ [ $RETVAL = 0 ] && success || failure
echo
- [ $RETVAL -eq 0 ] && rm -f $lockfile
+ [ $RETVAL = 0 ] && rm -f $lockfile
return $RETVAL
}
-# See how we were called.
+if [ ! -x $dhcrelay ]; then
+ RETVAL=5
+ exit $RETVAL
+fi
+
+if [ $# -gt 1 ]; then
+ RETVAL=2
+ exit $RETVAL
+fi
+
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
- reload)
- RETVAL=3
+ restart|force-reload)
+ stop && start
+ RETVAL=$?
;;
- restart)
- stop
- start
+ try-restart|reload)
+ RETVAL=3
;;
condrestart)
if [ -f $lockfile ]; then
- stop
- start
+ stop && start
+ RETVAL=$?
fi
;;
+ configtest)
+ configtest
+ RETVAL=$?
+ ;;
status)
status $prog
RETVAL=$?
;;
*)
- echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
RETVAL=3
;;
esac
More information about the fedora-extras-commits
mailing list