- init script modified to be POSIX compliant

This commit is contained in:
Jiri Skala 2009-02-02 13:30:24 +00:00
parent fe3340a985
commit 8d54d179a9
4 changed files with 162 additions and 70 deletions

106
radvd-1.1-posix.patch Normal file
View File

@ -0,0 +1,106 @@
diff -up radvd-1.1/redhat/radvd.init.posix radvd-1.1/redhat/radvd.init
--- radvd-1.1/redhat/radvd.init.posix 2009-02-02 14:20:48.000000000 +0100
+++ radvd-1.1/redhat/radvd.init 2009-02-02 14:28:45.000000000 +0100
@@ -28,12 +28,6 @@
[ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd
-if [ "$1" == "status" ]; then
- [ -f /usr/sbin/radvd ] || exit 4
-else
- [ -f /usr/sbin/radvd ] || exit 1
-fi
-
RETVAL=0
PROG="radvd"
LOCKFILE=/var/lock/subsys/radvd
@@ -41,48 +35,53 @@ LOCKFILE=/var/lock/subsys/radvd
# See how we were called.
case "$1" in
start)
-
- # Check that networking is up.
- [ "${NETWORKING_IPV6}" = "yes" ] || exit 1
-
- echo -n $"Starting $PROG: "
- daemon radvd $OPTIONS
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && touch $LOCKFILE
- ;;
+ if [ ! -f /etc/radvd.conf ]; then
+ echo "Configuration file /etc/radvd.conf missing" 1>&2
+ exit 6
+ fi
+ if [ ! -x /usr/sbin/radvd ]; then
+ echo "Insufficient privilege" 1>&2
+ exit 4
+ fi
+ echo -n $"Starting $prog: "
+ echo -n $"Starting $PROG: "
+ daemon radvd $OPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ ;;
stop)
- echo -n $"Stopping $PROG: "
- killproc radvd
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
- ;;
+ echo -n $"Stopping $PROG: "
+ killproc radvd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+ ;;
status)
- status radvd
- RETVAL=$?
- ;;
+ status radvd
+ RETVAL=$?
+ ;;
restart)
- $0 stop
- $0 start
- RETVAL=$?
- ;;
+ $0 stop
+ $0 start
+ RETVAL=$?
+ ;;
reload)
- echo -n $"Reloading $PROG: "
- killproc radvd -HUP
- RETVAL=$?
- echo
- ;;
+ echo -n $"Reloading $PROG: "
+ killproc radvd -HUP
+ RETVAL=$?
+ echo
+ ;;
condrestart)
- if [ -f $LOCKFILE ]; then
- $0 stop
- $0 start
- RETVAL=$?
- fi
- ;;
+ if [ -f $LOCKFILE ]; then
+ $0 stop
+ $0 start
+ RETVAL=$?
+ fi
+ ;;
*)
- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
- exit 2
+ echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
+ exit 2
esac
exit $RETVAL

View File

@ -1,21 +0,0 @@
diff -up radvd-1.1/redhat/radvd.init.string_cmp radvd-1.1/redhat/radvd.init
--- radvd-1.1/redhat/radvd.init.string_cmp 2008-02-25 11:27:36.000000000 +0100
+++ radvd-1.1/redhat/radvd.init 2008-02-25 11:30:30.000000000 +0100
@@ -28,7 +28,7 @@
[ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd
-if [ $1 == 'status' ]; then
+if [ "$1" == "status" ]; then
[ -f /usr/sbin/radvd ] || exit 4
else
[ -f /usr/sbin/radvd ] || exit 1
@@ -43,7 +43,7 @@ case "$1" in
start)
# Check that networking is up.
- [ x${NETWORKING_IPV6} = "xyes" ] || exit 1
+ [ "${NETWORKING_IPV6}" = "yes" ] || exit 1
echo -n $"Starting $PROG: "
daemon radvd $OPTIONS

View File

@ -1,8 +1,11 @@
#! /bin/sh #! /bin/sh
# #
# $Id: radvd.init,v 1.1 2001/04/11 15:58:30 psavola Exp $ # $Id: radvd.init,v 1.4 2007/12/01 08:50:16 psavola Exp $
# #
### BEGIN INIT INFO
# provides: radvd
# chkconfig: - 54 46 # chkconfig: - 54 46
# short-Description: router advertisement daemon for IPv6
# description: radvd is the router advertisement daemon for IPv6. It \ # description: radvd is the router advertisement daemon for IPv6. It \
# listens to router solicitations and sends router \ # listens to router solicitations and sends router \
# advertisements as described in "Neighbor Discovery for IP \ # advertisements as described in "Neighbor Discovery for IP \
@ -15,6 +18,7 @@
# pidfile: /var/run/radvd.pid # pidfile: /var/run/radvd.pid
# config: /etc/radvd.conf # config: /etc/radvd.conf
# config: /etc/sysconfig/radvd # config: /etc/sysconfig/radvd
### END INIT INFO
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
@ -22,62 +26,62 @@
# Get config. # Get config.
. /etc/sysconfig/network . /etc/sysconfig/network
# Check that networking is up.
if [ ! "${NETWORKING_IPV6}" = "yes" ]; then
echo "Networking IPv6 is disabled" 1>&2
exit 1
fi
if [ ! -f /etc/radvd.conf ]; then
echo "Configuration file /etc/radvd.conf missing" 1>&2
exit 6
fi
[ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd [ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd
if [ ! -x /usr/sbin/radvd ]; then
echo "Insufficient privilege" 1>&2
exit 4
fi
RETVAL=0 RETVAL=0
prog="radvd" PROG="radvd"
LOCKFILE=/var/lock/subsys/radvd
# See how we were called. # See how we were called.
case "$1" in case "$1" in
start) start)
if [ ! -f /etc/radvd.conf ]; then
echo "Configuration file /etc/radvd.conf missing" 1>&2
exit 6
fi
if [ ! -x /usr/sbin/radvd ]; then
echo "Insufficient privilege" 1>&2
exit 4
fi
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
echo -n $"Starting $PROG: "
daemon radvd $OPTIONS daemon radvd $OPTIONS
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/radvd [ $RETVAL -eq 0 ] && touch $LOCKFILE
;; ;;
stop) stop)
echo -n $"Stopping $prog: " echo -n $"Stopping $PROG: "
killproc radvd killproc radvd
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/radvd [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
;; ;;
status) status)
status radvd status radvd
RETVAL=$? RETVAL=$?
;; ;;
restart|reload) restart)
$0 stop $0 stop
$0 start $0 start
RETVAL=$? RETVAL=$?
;; ;;
reload)
echo -n $"Reloading $PROG: "
killproc radvd -HUP
RETVAL=$?
echo
;;
condrestart) condrestart)
if [ -f /var/lock/subsys/radvd ]; then if [ -f $LOCKFILE ]; then
$0 stop $0 stop
$0 start $0 start
RETVAL=$? RETVAL=$?
fi fi
;; ;;
*) *)
echo $"Usage: radvd {start|stop|status|restart|reload|condrestart}" echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1 exit 2
esac esac
exit $RETVAL exit $RETVAL

View File

@ -5,7 +5,7 @@
Summary: A Router Advertisement daemon Summary: A Router Advertisement daemon
Name: radvd Name: radvd
Version: 1.1 Version: 1.1
Release: 5%{?dist} Release: 6%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible # The code includes the advertising clause, so it's GPL-incompatible
License: BSD with advertising License: BSD with advertising
Group: System Environment/Daemons Group: System Environment/Daemons
@ -18,7 +18,7 @@ Requires(pre): /usr/sbin/useradd
BuildRequires: flex, byacc BuildRequires: flex, byacc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: radvd-1.1-string_cmp.patch Patch0: radvd-1.1-posix.patch
Patch1: radvd-1.1-stale_pid.patch Patch1: radvd-1.1-stale_pid.patch
%description %description
@ -34,7 +34,7 @@ services.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .string_cmp %patch0 -p1 -b .posix
%patch1 -p1 -b .stale_pid %patch1 -p1 -b .stale_pid
%build %build
@ -97,6 +97,9 @@ fi
%{_sbindir}/radvdump %{_sbindir}/radvdump
%changelog %changelog
* Mon Feb 02 2009 Jiri Skala <jskala@redhat.com> - 1.1-6
- init script modified to be POSIX compliant
* Wed Sep 3 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.1-5 * Wed Sep 3 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.1-5
- fix license tag - fix license tag