[openwsman] Move initscript to the right place, Fix return values from initscript according to guidelines

vcrhonek vcrhonek at fedoraproject.org
Mon Sep 13 14:35:03 UTC 2010


commit 6091aaca73f06c7b2968ce742be99d510513ba47
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date:   Mon Sep 13 16:33:06 2010 +0200

    Move initscript to the right place, Fix return values from initscript according to guidelines

 openwsman-2.2.3-initscript.patch |   64 ++++++++++++++++++++++++++++++++++++++
 openwsman.spec                   |   15 ++++++--
 2 files changed, 75 insertions(+), 4 deletions(-)
---
diff --git a/openwsman-2.2.3-initscript.patch b/openwsman-2.2.3-initscript.patch
new file mode 100644
index 0000000..a41f418
--- /dev/null
+++ b/openwsman-2.2.3-initscript.patch
@@ -0,0 +1,64 @@
+diff -up openwsman-2.2.3/etc/init/openwsmand.sh.in.orig openwsman-2.2.3/etc/init/openwsmand.sh.in
+--- openwsman-2.2.3/etc/init/openwsmand.sh.in.orig	2010-09-06 15:49:57.000000000 +0200
++++ openwsman-2.2.3/etc/init/openwsmand.sh.in	2010-09-13 15:09:17.823620695 +0200
+@@ -19,13 +19,13 @@
+ NAME=openwsmand
+ DAEMON=/usr/sbin/$NAME
+ OPTIONS=-S # with SSL
+-PIDFILE=/var/run/$NAME.pid
++PIDFILE=/var/run/wsmand.pid
+ 
+ lsb=0
+ 
+ if [ $EUID != 0 ]; then
+  echo "This script must be run as root."
+- exit 1;
++ exit 4;
+ fi
+ 
+ if [ "$DESCRIPTIVE" = "" ]; then
+@@ -65,6 +65,7 @@ start()
+ 
+ 	echo "NOTE: The script uses /dev/random device for generating some random bits while generating the server key."
+ 	echo -e "      If this takes too long, you can replace the value of \"RANDFILE\" in @SYSCONFDIR@/ssleay.cnf with /dev/urandom.\n      Please understand the implications of doing do."
++        exit 6 # Six means "program is not configured", seems to be suitable value
+ 		
+       fi
+     fi
+@@ -103,6 +104,9 @@ case "$1" in
+     stop)
+     	stop
+ 	rm -f $lockfile
++	# pid file should be removed by server itself, but it's marked as
++	# TODO in wsmand.c source file;)
++        rm -f $PIDFILE
+     ;;
+ 
+     restart)
+@@ -136,7 +140,16 @@ case "$1" in
+       if [ $? -eq 0 ]; then
+         echo "             running"
+       else
+-        echo "             stopped"
++        if [ -e $PIDFILE ]; then
++          echo "             stopped, but pid file exists"
++          exit 1
++        elif [ -e $lockfile ]; then
++          echo "             stopped, but lock file exists"
++          exit 2
++        else
++          echo "             stopped"
++          exit 3
++        fi
+       fi
+     fi
+     ;;
+@@ -147,6 +160,8 @@ case "$1" in
+ 
+     *)
+     echo "Usage: $0 {restart|start|stop|reload|force-reload|status}"
++    [ "$1" = "usage" ] && exit 0
++    exit 2
+ esac
+ 
+ if [ $lsb -ne 0 ]; then
diff --git a/openwsman.spec b/openwsman.spec
index 6c076ed..c18f2e7 100644
--- a/openwsman.spec
+++ b/openwsman.spec
@@ -28,6 +28,7 @@ Patch1:         %{name}-randfile.patch
 Patch2:         %{name}-authors.patch
 Patch3:		%{name}-swig-ver-check.patch
 Patch4:		%{name}-sitelibdir.patch
+Patch5:		openwsman-2.2.3-initscript.patch
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXXX)
 
 %description
@@ -143,6 +144,7 @@ This package provides Perl bindings to access the openwsman client API.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1 -b .initscript
 
 %build
 sh autoconfiscate.sh
@@ -171,8 +173,9 @@ rm -f %{buildroot}/%{_libdir}/openwsman/authenticators/*.la
 mkdir -p %{buildroot}/%{_sysconfdir}/init.d
 install -m 644 etc/openwsman.conf %{buildroot}/%{_sysconfdir}/openwsman
 install -m 644 etc/ssleay.cnf %{buildroot}/%{_sysconfdir}/openwsman
-install -m 755 etc/init/openwsmand.sh %{buildroot}/%{_sysconfdir}/init.d/openwsmand
-ln -sf %{_sysconfdir}/init.d/openwsmand %{buildroot}/%{_sbindir}/rcopenwsmand
+mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/init.d
+install -m 755 etc/init/openwsmand.sh %{buildroot}/%{_sysconfdir}/rc.d/init.d/openwsmand
+ln -sf %{_sysconfdir}/rc.d/init.d/openwsmand %{buildroot}/%{_sbindir}/rcopenwsmand
 
 %clean
 rm -rf %{buildroot}
@@ -183,7 +186,7 @@ rm -rf %{buildroot}
 
 %post server
 /sbin/ldconfig
-chkconfig --add  openwsmand
+/sbin/chkconfig --add openwsmand
 
 %preun server
 if [ $1 = 0 ] ; then
@@ -248,7 +251,7 @@ fi
 %config(noreplace) %{_sysconfdir}/openwsman/ssleay.cnf
 %attr(0755,root,root) %{_sysconfdir}/openwsman/owsmangencert.sh
 %config(noreplace) %{_sysconfdir}/pam.d/openwsman
-%attr(0755,root,root) %{_sysconfdir}/init.d/openwsmand
+%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/openwsmand
 %dir %{_libdir}/openwsman
 %dir %{_libdir}/openwsman/authenticators
 %{_libdir}/openwsman/authenticators/*.so
@@ -268,6 +271,10 @@ fi
 
 
 %changelog
+* Mon Sep 13 2010 Vitezslav Crhonek <vcrhonek at redhat.com> - 2.2.3-8
+- Move initscript to the right place
+- Fix return values from initscript according to guidelines
+
 * Tue Aug 10 2010 Praveen K Paladugu <praveen_paladugu at dell.com> - 2.2.3-7
 - Moved the certificate generation from init script. The user will have to 
 -   generate the certificate manually.


More information about the scm-commits mailing list