Fix initscript

This commit is contained in:
vcrhonek 2010-04-22 12:04:57 +00:00
parent 75da8c1824
commit a219604aa8
2 changed files with 96 additions and 2 deletions

View File

@ -0,0 +1,89 @@
diff -up sblim-sfcb-1.3.7/sfcb.init-redhat.in.orig sblim-sfcb-1.3.7/sfcb.init-redhat.in
--- sblim-sfcb-1.3.7/sfcb.init-redhat.in.orig 2010-04-20 16:02:21.000000000 +0200
+++ sblim-sfcb-1.3.7/sfcb.init-redhat.in 2010-04-22 13:32:36.588476172 +0200
@@ -13,6 +13,9 @@
# Source function library.
. /etc/init.d/functions
+SFCB_BIN=@sbindir@/sfcbd
+LOCKFILE=/var/lock/subsys/sblim-sfcb
+
echo $PATH | grep -q @sbindir@ ||PATH=@sbindir@:$PATH
if [ -z "$LD_LIBRARY_PATH" ] || echo $LD_LIBRARY_PATH | grep -qv @libdir@
@@ -22,17 +25,25 @@ then
fi
start() {
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
echo -n "Starting sfcb: "
- daemon @sbindir@/sfcbd -d &&
- touch /var/lock/subsys/sfcb &&
+ daemon $SFCB_BIN -d &&
+ touch $LOCKFILE &&
return 0 ||
return 1
}
stop() {
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
echo -n "Shutting down sfcb: "
killproc sfcbd &&
- rm -f /var/lock/subsys/sfcb &&
+ rm -f $LOCKFILE &&
return 0 || return 1
}
@@ -50,9 +61,30 @@ case "$1" in
stop
;;
status)
- status sfcbd
+ pid=`pidofproc $SFCB_BIN`
+ RETVAL=$?
+ if [ "$RETVAL" -eq 0 ]; then
+ echo -n $"sfcb ($pid) is running"
+ exit 0
+ else
+ if [ -e /var/run/tog-pegasus.pid ]; then
+ echo $"sfcb is not running, but pid file exists"
+ exit 1
+ elif [ -e $LOCKFILE ]; then
+ echo $"sfcb is not running, but lock file exists"
+ exit 2
+ else
+ echo $"sfcb is not running"
+ exit 3
+ fi
+ fi
+ echo
;;
restart)
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
stop
start
;;
@@ -60,11 +92,12 @@ case "$1" in
reload
;;
condrestart)
- [ -f /var/lock/subsys/sfcb ] && restart || :
+ [ -f $LOCKFILE ] && restart || :
;;
*)
echo "Usage: sfcb {start|stop|status|reload|restart|condrestart}"
- exit 1
+ [ "$1" = "usage" ] && exit 0
+ exit 2
;;
esac
exit $?

View File

@ -1,5 +1,5 @@
#
# $Id: sblim-sfcb.spec,v 1.3 2010/03/22 12:58:09 vcrhonek Exp $
# $Id: sblim-sfcb.spec,v 1.4 2010/04/22 12:04:57 vcrhonek Exp $
#
# Package spec for sblim-sfcb
#
@ -8,13 +8,14 @@ Name: sblim-sfcb
Summary: Small Footprint CIM Broker
URL: http://www.sblim.org
Version: 1.3.7
Release: 2%{?dist}
Release: 3%{?dist}
Group: Applications/System
License: EPL
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Source0: http://downloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
Patch0: %{name}-disable_auto_service_start.patch
Patch1: sblim-sfcb-1.3.7-value.c.patch
Patch2: sblim-sfcb-1.3.7-initscript.patch
Provides: cim-server
Requires: cim-schema
BuildRequires: libcurl-devel
@ -43,6 +44,7 @@ Programming Interface (CMPI).
%setup -q -T -b 0 -n %{name}-%{version}
%patch0 -p1 -b .autostart
%patch1 -p1 -b .valuec
%patch2 -p1 -b .initscript
%build
%configure --enable-debug --enable-ssl --enable-pam --enable-ipv6 CFLAGS="$CFLAGS -D_GNU_SOURCE"
@ -109,6 +111,9 @@ fi
#%doc COPYING README
%changelog
* Thu Apr 22 2010 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.3.7-3
- Fix initscript
* Mon Mar 22 2010 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.3.7-2
- Make sblim-sfcb post install scriptlet silent
- Fix value.c