From 77d41b37af29c90caff18abf8a4926fdc6fdf30d Mon Sep 17 00:00:00 2001 From: vcrhonek Date: Wed, 23 Sep 2009 13:36:42 +0000 Subject: [PATCH] Fix initscript --- pegasus-2.9.0-initscript.patch | 179 ++++++++++++++++++++------------- tog-pegasus.spec | 6 +- 2 files changed, 116 insertions(+), 69 deletions(-) diff --git a/pegasus-2.9.0-initscript.patch b/pegasus-2.9.0-initscript.patch index c5e4cc8..876a1d7 100644 --- a/pegasus-2.9.0-initscript.patch +++ b/pegasus-2.9.0-initscript.patch @@ -1,7 +1,7 @@ diff -up pegasus/rpm/tog-pegasus.rc_old pegasus/rpm/tog-pegasus.rc --- pegasus/rpm/tog-pegasus.rc_old 2008-12-02 10:00:03.000000000 +0100 -+++ pegasus/rpm/tog-pegasus.rc 2009-03-18 14:39:40.000000000 +0100 -@@ -1,78 +1,108 @@ ++++ pegasus/rpm/tog-pegasus.rc 2009-09-23 14:52:10.000000000 +0200 +@@ -1,98 +1,153 @@ -#//%LICENSE//////////////////////////////////////////////////////////////// -#// -#// Licensed to The Open Group (TOG) under one or more contributor license @@ -72,113 +72,156 @@ diff -up pegasus/rpm/tog-pegasus.rc_old pegasus/rpm/tog-pegasus.rc case "$1" in start) +- echo -n $"Starting up CIM server: " +- $CIMSERVER_BIN +- RETVAL=$? +- [ "$RETVAL" -eq 0 ] && log_success_msg $"$prog start" || log_failure_msg $"$prog start" +- echo +- ;; ++ if [[ $EUID -ne 0 ]]; then ++ echo "tog-pegasus $1: $CIMSERVER_BIN executed under nonprivileged user" ++ exit 4 ++ fi + pid=`pidofproc $CIMSERVER_BIN` + RETVAL=$? + if [ "$RETVAL" -eq 0 ]; then -+ echo "tog-pegasus $1: $CIMSERVER_BIN is already running"; -+ exit 0; -+ fi; ++ echo "tog-pegasus $1: $CIMSERVER_BIN is already running" ++ exit 0 ++ fi + + if [ ! -e $CIMSERVER_BIN ]; then -+ echo "tog-pegasus $1: $CIMSERVER_BIN not found"; -+ failure; -+ exit 5; -+ fi; ++ echo "tog-pegasus $1: $CIMSERVER_BIN not found" ++ failure ++ exit 5 ++ fi + + if [ ! -x $CIMSERVER_BIN ]; then -+ echo "tog-pegasus $1: $CIMSERVER_BIN not executable"; -+ failure; -+ exit 4; -+ fi; ++ echo "tog-pegasus $1: $CIMSERVER_BIN not executable" ++ failure ++ exit 4 ++ fi + + if [ ! -e ${PEGASUS_SSL_CONF_FILE} ] || [ ! -e ${PEGASUS_SSL_CERT_FILE} ] || + [ ! -e ${PEGASUS_SSL_KEY_FILE} ] || [ ! -e ${PEGASUS_SSL_TRUSTSTORE} ]; then + if [ -x /usr/share/Pegasus/scripts/genOpenPegasusSSLCerts ]; then -+ echo -n "tog-pegasus: Generating cimserver SSL certificates..."; -+ /usr/share/Pegasus/scripts/genOpenPegasusSSLCerts; ++ echo -n "tog-pegasus: Generating cimserver SSL certificates..." ++ /usr/share/Pegasus/scripts/genOpenPegasusSSLCerts + if [ $? -eq 0 ]; then -+ success; ++ success + else -+ failure; -+ fi; -+ echo; -+ fi; -+ fi; - echo -n $"Starting up CIM server: " -- $CIMSERVER_BIN ++ failure ++ fi ++ echo ++ fi ++ fi ++ echo -n $"Starting up CIM server: " + $CIMSERVER_BIN ${CIMSERVER_OPTIONS} - RETVAL=$? -- [ "$RETVAL" -eq 0 ] && log_success_msg $"$prog start" || log_failure_msg $"$prog start" -- echo ++ RETVAL=$? + if [ "$RETVAL" -eq 0 ]; then -+ touch $LOCKFILE; -+ success; ++ rm -f /var/run/tog-pegasus.pid; ++ ln -s /var/run/tog-pegasus/"$prog".pid /var/run/tog-pegasus.pid; ++ touch $LOCKFILE ++ success + else -+ failure; -+ fi; -+ echo; - ;; ++ failure ++ fi ++ echo ++ ;; stop) - echo -n $"Shutting down CIM server: " - killproc cimserver - RETVAL=$? +- echo -n $"Shutting down CIM server: " +- killproc cimserver +- RETVAL=$? - [ "$RETVAL" -eq 0 ] && log_success_msg $"$prog stop" || log_failure_msg $"$prog stop" - echo +- ;; ++ if [[ $EUID -ne 0 ]]; then ++ echo "tog-pegasus $1: $CIMSERVER_BIN executed under nonprivileged user" ++ exit 4 ++ fi ++ echo -n $"Shutting down CIM server: " ++ killproc cimserver ++ RETVAL=$? + if [ "$RETVAL" -eq 0 ]; then -+ rm -f $LOCKFILE; -+ rm -f /var/run/tog-pegasus/*; -+ success; ++ rm -f $LOCKFILE ++ rm -f /var/run/tog-pegasus/* ++ rm -f /var/run/tog-pegasus.pid ++ success + else -+ failure; -+ fi; -+ echo; - ;; ++ failure ++ fi ++ echo ++ ;; + status) - pid=`pidofproc $CIMSERVER_BIN` - RETVAL=$? - if [ "$RETVAL" -eq 0 ]; then +- pid=`pidofproc $CIMSERVER_BIN` +- RETVAL=$? +- if [ "$RETVAL" -eq 0 ]; then - echo "CIM server is running" -+ echo -n $"CIM server ($pid) is running"; -+ RETVAL=0 - else +- else - echo "CIM server is not running" - fi -+ echo -n $"CIM server is not running"; -+ RETVAL=3 -+ fi; -+ echo; - ;; +- ;; ++ pid=`pidofproc $CIMSERVER_BIN` ++ RETVAL=$? ++ if [ "$RETVAL" -eq 0 ]; then ++ echo -n $"CIM server ($pid) is running" ++ exit 0 ++ else ++ if [ -e /var/run/tog-pegasus.pid ]; then ++ echo $"CIM server is not running, but pid file exists" ++ exit 1 ++ elif [ -e $LOCKFILE ]; then ++ echo $"CIM server is not running, but lock file exists" ++ exit 2 ++ else ++ echo $"CIM server is not running" ++ exit 3 ++ fi ++ fi ++ echo ++ ;; + condrestart) - pid=`pidofproc $CIMSERVER_BIN` - RETVAL=$? -@@ -81,18 +111,23 @@ case "$1" in - RETVAL=$?; - fi; +- pid=`pidofproc $CIMSERVER_BIN` +- RETVAL=$? +- if [ "$RETVAL" -eq 0 ]; then +- $0 stop && $0 start; +- RETVAL=$?; +- fi; ++ pid=`pidofproc $CIMSERVER_BIN` ++ RETVAL=$? ++ if [ "$RETVAL" -eq 0 ]; then ++ $0 stop && $0 start ++ RETVAL=$? ++ fi; ;; + try-restart) - $0 stop && $0 start -+ $0 stop && $0 start; -+ RETVAL=$?; - ;; +- ;; ++ $0 stop && $0 start ++ RETVAL=$? ++ ;; + restart|force-reload) - $0 stop - $0 start -+ $0 stop; -+ $0 start; -+ RETVAL=$?; - ;; +- ;; ++ $0 stop ++ $0 start ++ RETVAL=$? ++ ;; + reload) - ;; +- ;; ++ ;; *) - echo "Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}" +- echo "Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}" - exit 1 -+ RETVAL=3 ++ echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}" ++ [ "$1" = "usage" ] && exit 0 ++ exit 2 esac exit $RETVAL diff --git a/tog-pegasus.spec b/tog-pegasus.spec index 6bfdb91..1270274 100644 --- a/tog-pegasus.spec +++ b/tog-pegasus.spec @@ -41,7 +41,7 @@ %endif Version: 2.9.0 -Release: 6%{?dist} +Release: 7%{?dist} Epoch: 2 # Summary: OpenPegasus WBEM Services for Linux @@ -463,6 +463,10 @@ fi %changelog +* Wed Sep 23 2009 Vitezslav Crhonek - 2:2.9.0-7 +- Fix initscript + Resolves: #523370 + * Wed Sep 16 2009 Tomas Mraz - 2:2.9.0-6 - Use password-auth common PAM configuration instead of system-auth