From 9c81a8e0042f19caac53e810a03c3d279187eed9 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Apr 26 2007 19:01:43 +0000 Subject: - Init script fixes (#237985, #237983) - Reference correct scripts in dhclient-script.8 man page (#238036) --- diff --git a/dhcp-3.0.5-manpages.patch b/dhcp-3.0.5-manpages.patch index 6fa4e1b..73ea521 100644 --- a/dhcp-3.0.5-manpages.patch +++ b/dhcp-3.0.5-manpages.patch @@ -1,5 +1,5 @@ --- dhcp-3.0.5/client/dhclient-script.8.manpages 2005-09-28 15:17:08.000000000 -0400 -+++ dhcp-3.0.5/client/dhclient-script.8 2007-03-29 14:55:09.000000000 -0400 ++++ dhcp-3.0.5/client/dhclient-script.8 2007-04-26 14:52:13.000000000 -0400 @@ -47,7 +47,7 @@ exit hooks provided (see HOOKS for details). These hooks will allow the user to override the default behaviour of the client in creating a @@ -20,7 +20,7 @@ +.B ETCDIR/dhclient-up-hooks +script, and source it if found. This script can handle DHCP options in +the environment that are not handled by default. A per-interface -+.B ETCDIR/dhclient-up-${IF}-hooks ++.B ETCDIR/dhclient-${IF}-up-hooks +script will override the generic script and be sourced when interface +$IF has been brought up. +.PP @@ -30,7 +30,7 @@ +.B ETCDIR/dhclient-down-hooks +script, and source it if found. This script can handle DHCP options in +the environment that are not handled by default. A per-interface -+.B ETCDIR/dhclient-down-${IF}-hooks ++.B ETCDIR/dhclient-${IF}-down-hooks +script will override the generic script and be sourced when interface +$IF is about to be brought down. + @@ -38,7 +38,7 @@ When dhclient needs to invoke the client configuration script, it defines a set of variables in the environment, and then invokes --- dhcp-3.0.5/client/dhclient.conf.5.manpages 2005-06-16 15:40:13.000000000 -0400 -+++ dhcp-3.0.5/client/dhclient.conf.5 2007-03-29 14:55:21.000000000 -0400 ++++ dhcp-3.0.5/client/dhclient.conf.5 2007-04-26 14:51:02.000000000 -0400 @@ -185,7 +185,8 @@ options. Only the option names should be specified in the request statement - not option parameters. By default, the DHCP server @@ -68,8 +68,8 @@ .SH SAMPLE The following configuration file is used on a laptop running NetBSD 1.3. The laptop has an IP alias of 192.5.5.213, and has one ---- dhcp-3.0.5/client/dhclient.8.manpages 2007-03-29 14:54:16.000000000 -0400 -+++ dhcp-3.0.5/client/dhclient.8 2007-03-29 14:58:16.000000000 -0400 +--- dhcp-3.0.5/client/dhclient.8.manpages 2007-04-26 14:51:02.000000000 -0400 ++++ dhcp-3.0.5/client/dhclient.8 2007-04-26 14:51:02.000000000 -0400 @@ -85,6 +85,28 @@ .B -x ] @@ -208,7 +208,7 @@ The syntax of the dhclient.conf(5) file is discussed separately. .SH OMAPI --- dhcp-3.0.5/common/dhcp-options.5.manpages 2006-04-26 11:12:43.000000000 -0400 -+++ dhcp-3.0.5/common/dhcp-options.5 2007-03-29 14:58:42.000000000 -0400 ++++ dhcp-3.0.5/common/dhcp-options.5 2007-04-26 14:51:02.000000000 -0400 @@ -834,6 +834,24 @@ classless IP routing is now the most widely deployed routing standard, this option is virtually useless, and is not implemented by any of the @@ -235,7 +235,7 @@ .PP .nf --- dhcp-3.0.5/dhcpctl/dhcpctl.3.manpages 2004-09-24 17:08:38.000000000 -0400 -+++ dhcp-3.0.5/dhcpctl/dhcpctl.3 2007-03-29 14:59:16.000000000 -0400 ++++ dhcp-3.0.5/dhcpctl/dhcpctl.3 2007-04-26 14:51:02.000000000 -0400 @@ -43,7 +43,8 @@ .\" .\" @@ -256,7 +256,7 @@ int main (int argc, char **argv) { dhcpctl_data_string ipaddrstring = NULL; --- dhcp-3.0.5/server/dhcpd.conf.5.manpages 2006-07-09 11:02:24.000000000 -0400 -+++ dhcp-3.0.5/server/dhcpd.conf.5 2007-03-29 14:58:59.000000000 -0400 ++++ dhcp-3.0.5/server/dhcpd.conf.5 2007-04-26 14:51:02.000000000 -0400 @@ -531,9 +531,9 @@ failover peer "foo" { primary; diff --git a/dhcp.spec b/dhcp.spec index 9ee4bf3..0a2d19a 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -10,7 +10,7 @@ Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent Name: dhcp Version: 3.0.5 -Release: 33%{?dist} +Release: 34%{?dist} Epoch: 12 License: ISC Group: System Environment/Daemons @@ -429,6 +429,10 @@ fi %{_libdir}/libdhcp4client.a %changelog +* Thu Apr 26 2007 David Cantrell - 12:3.0.5-34 +- Init script fixes (#237985, #237983) +- Reference correct scripts in dhclient-script.8 man page (#238036) + * Fri Apr 20 2007 David Cantrell - 12:3.0.5-33 - Rename -devel-static packages to -static (#225691) diff --git a/dhcpd.init b/dhcpd.init index a1541f3..1c33454 100644 --- a/dhcpd.init +++ b/dhcpd.init @@ -1,128 +1,104 @@ -#!/bin/sh -# -# dhcpd This shell script takes care of starting and stopping -# dhcpd. +#!/bin/bash # # chkconfig: - 65 35 # description: dhcpd provide access to Dynamic Host Control Protocol. # Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network -. /etc/sysconfig/dhcpd +. /etc/init.d/functions -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 +RETVAL=0 +prog=dhcpd +dhcpd=/usr/sbin/dhcpd +lockfile=/var/lock/subsys/dhcpd -[ -f /usr/sbin/dhcpd ] || exit 0 +. /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}; - fi; - done; +cfOption() { + let i=0 + for a in $* ; do + ((++i)) + if [ $a = -cf ]; then + ((++i)) + eval 'echo $'$i + elif [[ $a = -cf* ]]; then + echo ${a#-cf} + fi + done } CF=`cfOption $DHCPDARGS` if [ -z "$CF" ]; then - CF='/etc/dhcpd.conf'; + CF='/etc/dhcpd.conf' fi [ -f "$CF" ] || exit 0 + if [ ! -f /var/lib/dhcpd/dhcpd.leases ] ; then - mkdir -p /var/lib/dhcpd - touch /var/lib/dhcpd/dhcpd.leases - [ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon /var/lib/dhcp/dhcpd.leases >/dev/null 2>&1 + mkdir -p /var/lib/dhcpd + touch /var/lib/dhcpd/dhcpd.leases + [ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon /var/lib/dhcp/dhcpd.leases >/dev/null 2>&1 fi -RETVAL=0 -prog="dhcpd" - -configtest() -{ - /usr/sbin/dhcpd -q -t -cf $CF - return $? +configtest() { + [ -x $dhcpd ] || return 5 + [ -f $CF ] || return 6 + $dhcpd -q -t -cf $CF + RETVAL=$? + return $RETVAL } start() { - # Start daemons. - echo -n $"Starting $prog: " - daemon /usr/sbin/dhcpd ${DHCPDARGS} 2>/dev/null - RETVAL=$? - echo - if [ $RETVAL -eq 0 ]; then - touch /var/lock/subsys/dhcpd - if [ -x /usr/bin/logger ]; then - /usr/bin/logger -t dhcpd 'dhcpd startup succeeded' - fi; - else - if [ -x /usr/bin/logger ]; then - /usr/bin/logger -t dhcpd 'dhcpd startup failed' - fi; - fi - return $RETVAL + [ -x $dhcpd ] || return 5 + [ -f $CF ] || return 6 + echo -n $"Starting $prog: " + daemon $dhcpd $DHCPDARGS 2>/dev/null + RETVAL=$? + [ $RETVAL = 0 ] && touch $lockfile + return $RETVAL } stop() { - # Stop daemons. - echo -n $"Shutting down $prog: " - killproc dhcpd - RETVAL=$? - echo - if [ $RETVAL -eq 0 ]; then - rm -f /var/lock/subsys/dhcpd - if [ -x /usr/bin/logger ]; then - /usr/bin/logger -t dhcpd 'dhcpd shutdown succeeded' - fi; - else - if [ -x /usr/bin/logger ]; then - /usr/bin/logger -t dhcpd 'dhcpd shutdown failed' - fi; - fi - return $RETVAL + echo -n $"Shutting down $prog: " + killproc $prog -TERM + RETVAL=$? + [ $RETVAL = 0 ] && rm -f $lockfile + return $RETVAL } # See how we were called. case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - configtest || exit $? - stop - start - RETVAL=$? - ;; - condrestart) - if [ -f /var/lock/subsys/dhcpd ]; then - stop - start - RETVAL=$? - fi - ;; - configtest|check|testconfig|test) - configtest - RETVAL=$? - ;; - status) - status dhcpd - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}" - exit 1 + start) + start + ;; + stop) + stop + ;; + reload) + RETVAL=3 + ;; + restart) + configtest || exit $? + stop + start + ;; + condrestart) + if [ -f $lockfile ]; then + stop + start + fi + ;; + configtest|check|testconfig|test) + configtest + RETVAL=$? + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}" + RETVAL=3 + ;; esac exit $RETVAL - diff --git a/dhcrelay.init b/dhcrelay.init index fccb5fe..425a89d 100644 --- a/dhcrelay.init +++ b/dhcrelay.init @@ -1,82 +1,67 @@ -#!/bin/sh -# -# dhcrelay This shell script takes care of starting and stopping -# dhcrelay. +#!/bin/bash # # chkconfig: - 66 34 # description: dhcrelay provides a relay for Dynamic Host Control Protocol. -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Source dhcrelay configuration. We can't default a DHCPSERVERS entry! -if [ -f /etc/sysconfig/dhcrelay ] ; then - . /etc/sysconfig/dhcrelay - [ -n "$DHCPSERVERS" ] || exit 0 -else - exit 0 -fi - -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - -[ -f /usr/sbin/dhcrelay ] || exit 0 +# Source function library +. /etc/init.d/functions RETVAL=0 -prog="dhcrelay" +prog=dhcrelay +dhcrelay=/usr/sbin/dhcrelay +lockfile=/var/lock/subsys/dhcrelay start() { - # Start daemons. - echo -n $"Starting $prog: " - daemon /usr/sbin/dhcrelay \ - $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) \ - $DHCPSERVERS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay - return $RETVAL + [ -x $dhcrelay ] || exit 5 + [ -f /etc/sysconfig/dhcrelay ] || exit 6 + . /etc/sysconfig/dhcrelay + [ -z "$DHCPSERVERS" ] && exit 6 + echo -n $"Starting $prog: " + daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + return $RETVAL } stop() { - # Stop daemons. - echo -n $"Shutting down $prog: " - killproc dhcrelay - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay - return $RETVAL + echo -n $"Shutting down $prog: " + killproc $prog -TERM + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + return $RETVAL } # See how we were called. case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - stop - start - RETVAL=$? - ;; - condrestart) - if [ -f /var/lock/subsys/dhcrelay ]; then - stop - start - RETVAL=$? - fi - ;; - status) - status dhcrelay - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 + start) + start + ;; + stop) + stop + ;; + reload) + RETVAL=3 + ;; + restart) + stop + start + ;; + condrestart) + if [ -f $lockfile ]; then + stop + start + fi + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|condrestart|status}" + RETVAL=3 + ;; esac exit $RETVAL