- fixed #528178 - retval in init script to be posix compliant

This commit is contained in:
Jiri Skala 2009-10-18 20:13:47 +00:00
parent ac16992fcd
commit 386e109c43
4 changed files with 32 additions and 108 deletions

View File

@ -1,106 +0,0 @@
diff -up radvd-1.1/redhat/radvd.init.posix radvd-1.1/redhat/radvd.init
--- radvd-1.1/redhat/radvd.init.posix 2009-02-27 08:34:11.000000000 +0100
+++ radvd-1.1/redhat/radvd.init 2009-02-27 08:34:25.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.
- [ x${NETWORKING_IPV6} = "xyes" ] || 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

18
radvd-1.3-posix.patch Normal file
View File

@ -0,0 +1,18 @@
diff -up radvd-1.3/redhat/radvd.init.posix radvd-1.3/redhat/radvd.init
--- radvd-1.3/redhat/radvd.init.posix 2009-10-18 22:02:19.343363622 +0200
+++ radvd-1.3/redhat/radvd.init 2009-10-18 22:04:48.794336898 +0200
@@ -47,7 +47,13 @@ case "$1" in
daemon radvd $OPTIONS
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ if [ $RETVAL -eq 0 ]; then
+ touch $LOCKFILE
+ else
+ if [ -f $LOCKFILE ]; then
+ RETVAL=0
+ fi
+ fi
;;
stop)
echo -n $"Stopping $PROG: "

View File

@ -47,7 +47,13 @@ case "$1" in
daemon radvd $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
if [ $RETVAL -eq 0 ]; then
touch $LOCKFILE
else
if [ -f $LOCKFILE ]; then
RETVAL=0
fi
fi
;;
stop)
echo -n $"Stopping $PROG: "

View File

@ -5,7 +5,7 @@
Summary: A Router Advertisement daemon
Name: radvd
Version: 1.3
Release: 2%{?dist}
Release: 3%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible
License: BSD with advertising
Group: System Environment/Daemons
@ -17,6 +17,7 @@ Requires(post): chkconfig
Requires(pre): /usr/sbin/useradd
BuildRequires: flex, byacc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch1: radvd-1.3-posix.patch
%description
radvd is the router advertisement daemon for IPv6. It listens to router
@ -32,6 +33,8 @@ services.
%prep
%setup -q
%patch1 -p1 -b .posix
%build
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIE"
export LDFLAGS='-pie -Wl,-z,relro,-z,now,-z,noexecstack,-z,nodlopen'
@ -92,6 +95,9 @@ fi
%{_sbindir}/radvdump
%changelog
* Sun Oct 18 2009 Jiri Skala <jskala@redhat.com> - 1.3-3
- fixed #528178 - retval in init script to be posix compliant
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild