rpms/dhcp/devel dhcp.spec, 1.275, 1.276 dhcpd.init, 1.30, 1.31 dhcrelay.init, 1.11, 1.12

Jiří Popelka jpopelka at fedoraproject.org
Thu Sep 24 09:29:34 UTC 2009


Author: jpopelka

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5696

Modified Files:
	dhcp.spec dhcpd.init dhcrelay.init 
Log Message:
* Thu Sep 24 2009 Jiri Popelka <jpopelka at redhat.com> - 12:4.1.0p1-11
- Make dhcpd and dhcrelay init scripts LSB compliant (#522134, #522146)



Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -p -r1.275 -r1.276
--- dhcp.spec	22 Sep 2009 00:18:21 -0000	1.275
+++ dhcp.spec	24 Sep 2009 09:29:34 -0000	1.276
@@ -13,7 +13,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  %{basever}p1
-Release:  10%{?dist}
+Release:  11%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -481,6 +481,9 @@ fi
 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
 
 %changelog
+* Thu Sep 24 2009 Jiri Popelka <jpopelka at redhat.com> - 12:4.1.0p1-11
+- Make dhcpd and dhcrelay init scripts LSB compliant (#522134, #522146)
+
 * Mon Sep 21 2009 David Cantrell <dcantrell at redhat.com> - 12:4.1.0p1-10
 - Obsolete the dhcpv6 and dhcpv6-client packages
 


Index: dhcpd.init
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcpd.init,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -r1.30 -r1.31
--- dhcpd.init	17 Apr 2009 21:48:50 -0000	1.30
+++ dhcpd.init	24 Sep 2009 09:29:34 -0000	1.31
@@ -22,12 +22,12 @@
 # config: /var/lib/dhcpd/dhcpd.leases
 # pidfile: /var/run/dhcpd.pid
 
-. /etc/init.d/functions
+. /etc/rc.d/init.d/functions
 
 RETVAL=0
 
 prog=dhcpd
-dhcpd=/usr/sbin/dhcpd
+exec=/usr/sbin/dhcpd
 lockfile=/var/lock/subsys/dhcpd
 pidfile=/var/run/dhcpd.pid
 statedir=/var/lib/dhcpd
@@ -49,7 +49,7 @@ findConfig() {
     echo "/etc/dhcp/dhcpd.conf"
 }
 
-conf="$(findConfig "$DHCPDARGS")"
+config="$(findConfig "$DHCPDARGS")"
 
 if [ ! -f $statedir/dhcpd.leases ] ; then
     mkdir -p $statedir
@@ -58,12 +58,12 @@ if [ ! -f $statedir/dhcpd.leases ] ; the
 fi
 
 configtest() {
-    [ -x $dhcpd ] || return 5
-    [ -f $conf ] || return 6
-    $dhcpd -q -t -cf $conf
+    [ -x $exec ] || return 5
+    [ -f $config ] || return 6
+    $exec -q -t -cf $config
     RETVAL=$?
     if [ $RETVAL -eq 1 ]; then
-        $dhcpd -t -cf $conf
+        $exec -t -cf $config
     else
         echo "Syntax: OK" >&2
     fi
@@ -71,37 +71,44 @@ configtest() {
 }
 
 start() {
-    [ -x $dhcpd ] || return 5
-    [ -f $conf ] || return 6
+    [ `id -u` -eq 0 ] || return 4
+    [ -x $exec ] || return 5
+    [ -f $config ] || return 6
 
     pidofproc $prog >/dev/null 2>&1
     RETVAL=$?
     [ $RETVAL -eq 0 ] && return $RETVAL
 
     echo -n $"Starting $prog: "
-    daemon $dhcpd $DHCPDARGS 2>/dev/null
+    daemon $exec $DHCPDARGS 2>/dev/null
     RETVAL=$?
     echo
-    [ $RETVAL = 0 ] && touch $lockfile
+    [ $RETVAL -eq 0 ] && touch $lockfile
     return $RETVAL
 }
 
 stop() {
+    [ `id -u` -eq 0 ] || return 4
+
     pidofproc $prog >/dev/null 2>&1
     if [ $? -ne 0 ]; then
-        RETVAL=7
+        RETVAL=0
         return $RETVAL
     fi
-
+    
     echo -n $"Shutting down $prog: "
     killproc $prog
     RETVAL=$?
 
     echo
-    [ $RETVAL = 0 ] && rm -f $lockfile
+    [ $RETVAL -eq 0 ] && rm -f $lockfile
     return $RETVAL
 }
 
+usage() {
+    echo $"Usage: $0 {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}"
+}
+
 if [ $# -gt 1 ]; then
     RETVAL=2
     exit $RETVAL
@@ -120,23 +127,28 @@ case "$1" in
         stop ; start
         RETVAL=$?
         ;;
-    condrestart)
+    condrestart|try-restart)
         if [ -f $lockfile ]; then
             stop ; start
             RETVAL=$?
         fi
         ;;
+    reload)
+        usage
+        # unimplemented feature
+        RETVAL=3
+        ;;
     configtest)
         configtest
         RETVAL=$?
         ;;
     status)
-        status $dhcpd
+        status $exec
         RETVAL=$?
         ;;
     *)
-        echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
-        RETVAL=3
+        usage
+        RETVAL=2
         ;;
 esac
 


Index: dhcrelay.init
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcrelay.init,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- dhcrelay.init	17 Apr 2009 21:48:50 -0000	1.11
+++ dhcrelay.init	24 Sep 2009 09:29:34 -0000	1.12
@@ -20,15 +20,15 @@
 # processname: dhcrelay
 # # pidfile: /var/run/dhcrelay.pid
 
-. /etc/init.d/functions
+. /etc/rc.d/init.d/functions
 
 RETVAL=0
 
 prog=dhcrelay
-dhcrelay=/usr/sbin/dhcrelay
+exec=/usr/sbin/dhcrelay
 lockfile=/var/lock/subsys/dhcrelay
 pidfile=/var/run/dhcrelay.pid
-conf=/etc/sysconfig/dhcrelay
+config=/etc/sysconfig/dhcrelay
 
 # The dhcrelay daemon uses the sysconfig file for configuration information.
 # There is no native configuration file for this program and you must specify
@@ -36,23 +36,24 @@ conf=/etc/sysconfig/dhcrelay
 [ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
 
 configtest() {
-    [ -x $dhcrelay ] || exit 5
-    [ -f $conf ] || exit 6
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
     [ -z "$DHCPSERVERS" ] && exit 6
     RETVAL=0
     return $RETVAL
 }
 
 start() {
-    [ -x $dhcrelay ] || exit 5
-    [ -f $conf ] || exit 6
+    [ `id -u` -eq 0 ] || exit 4
+    [ -x $exec ] || exit 5
+    [ -f $config ] || 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 2>/dev/null
+    daemon $exec $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS 2>/dev/null
     RETVAL=$?
     echo
     [ $RETVAL -eq 0 ] && touch $lockfile
@@ -60,9 +61,11 @@ start() {
 }
 
 stop() {
+    [ `id -u` -eq 0 ] || exit 4
+
     pidofproc $prog >/dev/null 2>&1
     if [ $? -ne 0 ]; then
-        RETVAL=7
+        RETVAL=0
         return $RETVAL
     fi
 
@@ -71,11 +74,17 @@ stop() {
     RETVAL=$?
 
     echo
-    [ $RETVAL = 0 ] && rm -f $lockfile
+    [ $RETVAL -eq 0 ] && rm -f $lockfile
+    # killproc -TERM doesn't remove pidfile, remove it manually
+    [ $RETVAL -eq 0 ] && rm -f $pidfile
     return $RETVAL
 }
 
-if [ ! -x $dhcrelay ]; then
+usage() {
+    echo $"Usage: $0 {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}"
+}
+
+if [ ! -x $exec ]; then
     RETVAL=5
     exit $RETVAL
 fi
@@ -98,12 +107,17 @@ case "$1" in
         stop && start
         RETVAL=$?
         ;;
-    condrestart)
+    condrestart|try-restart)
         if [ -f $lockfile ]; then
             stop && start
             RETVAL=$?
         fi
         ;;
+    reload)
+        usage
+        # unimplemented feature
+        RETVAL=3
+        ;;
     configtest)
         configtest
         RETVAL=$?
@@ -113,8 +127,8 @@ case "$1" in
         RETVAL=$?
         ;;
     *)
-        echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
-        RETVAL=3
+        usage
+        RETVAL=2
         ;;
 esac
 




More information about the scm-commits mailing list