Remove SysV init script

This commit is contained in:
Vitezslav Crhonek 2012-06-07 11:10:28 +02:00
commit 71c2893c0b
3 changed files with 15 additions and 129 deletions

View File

@ -1,89 +0,0 @@
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,19 +0,0 @@
*** /root/rpmbuild/SOURCES/sblim-sfcb-1.3.4.orig/sfcb.init-redhat.in 2005-06-13 18:20:33.000000000 +0530
--- sblim-sfcb-1.3.4.modified/sfcb.init-redhat.in 2009-09-03 19:59:01.000000000 +0530
***************
*** 2,8 ****
#
# $Id: sfcb.init-redhat.in,v 1.2 2005/06/13 12:50:33 mihajlov Exp $
#
! # chkconfig: 35 20 80
#
# description: Small Footprint CIM Broker Service
#
--- 2,8 ----
#
# $Id: sfcb.init-redhat.in,v 1.2 2005/06/13 12:50:33 mihajlov Exp $
#
! # chkconfig: - 20 80
#
# description: Small Footprint CIM Broker Service
#

View File

@ -8,16 +8,14 @@ Name: sblim-sfcb
Summary: Small Footprint CIM Broker
URL: http://www.sblim.org
Version: 1.3.14
Release: 1%{?dist}
Release: 2%{?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-initscript.patch
Patch2: sblim-sfcb-1.3.7-close_logging.patch
Patch3: sblim-sfcb-1.3.9-sfcbrepos-schema-location.patch
Patch4: sblim-sfcb-1.3.10-CMGetCharPtr.patch
Patch0: sblim-sfcb-1.3.7-close_logging.patch
Patch1: sblim-sfcb-1.3.9-sfcbrepos-schema-location.patch
Patch2: sblim-sfcb-1.3.10-CMGetCharPtr.patch
Source1: sfcb.service
Provides: cim-server
Requires: cim-schema
@ -49,11 +47,9 @@ Programming Interface (CMPI).
%prep
%setup -q -T -b 0 -n %{name}-%{version}
%patch0 -p1 -b .autostart
%patch1 -p1 -b .initscript
%patch2 -p1 -b .close_logging
%patch3 -p1 -b .sfcbrepos-schema-location
%patch4 -p1 -b .CMGetCharPtr
%patch0 -p1 -b .close_logging
%patch1 -p1 -b .sfcbrepos-schema-location
%patch2 -p1 -b .CMGetCharPtr
%build
%configure --enable-debug --enable-uds --enable-ssl --enable-pam --enable-ipv6 CFLAGS="$CFLAGS -D_GNU_SOURCE"
@ -64,33 +60,28 @@ make
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/%{_initddir}
mv $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/sfcb $RPM_BUILD_ROOT/%{_initddir}/sblim-sfcb
sed -i -e 's/\/var\/lock\/subsys\/sfcb/\/var\/lock\/subsys\/sblim-sfcb/g' $RPM_BUILD_ROOT/%{_initddir}/sblim-sfcb
rm $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/sfcb
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
install -p -m644 %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/sblim-sfcb.service
# remove unused static libraries and so files
rm -f $RPM_BUILD_ROOT/%{_libdir}/sfcb/*.la
#rm -f $RPM_BUILD_ROOT/%{_libdir}/sfcb/*.so
echo "%defattr(-,root,root,-)" > _pkg_list
find $RPM_BUILD_ROOT/%{_datadir}/sfcb -type f | grep -v $RPM_BUILD_ROOT/%{_datadir}/sfcb/CIM >> _pkg_list
sed -i s?$RPM_BUILD_ROOT??g _pkg_list > _pkg_list_2
#mv -f _pkg_list_2 _pkg_list
echo "%config(noreplace) %{_sysconfdir}/sfcb/*" >> _pkg_list
echo "%config(noreplace) %{_sysconfdir}/pam.d/*" >> _pkg_list
echo "%doc %{_datadir}/doc/*" >> _pkg_list
echo "%{_datadir}/man/man1/*" >> _pkg_list
echo "%{_initddir}/sblim-sfcb" >> _pkg_list
echo "%{_unitdir}/sblim-sfcb.service" >> _pkg_list
echo "%{_localstatedir}/lib/sfcb" >> _pkg_list
echo "%{_bindir}/*" >> _pkg_list
echo "%{_sbindir}/*" >> _pkg_list
echo "%{_libdir}/sfcb/*.so.*" >> _pkg_list
echo "%{_libdir}/sfcb/*.so" >> _pkg_list
#echo "%{_libdir}/sfcb/*.la" >> _pkg_list
cat _pkg_list
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
install -p -m644 %{SOURCE1} $RPM_BUILD_ROOT/lib/systemd/system/sfcb.service
%clean
rm -rf $RPM_BUILD_ROOT
@ -136,7 +127,7 @@ if [ $1 -eq 0 ]; then
fi;
%files -f _pkg_list
/lib/systemd/system/sfcb.service
#%files devel
#%defattr(-,root,root)
##%{_includedir}/*
@ -145,6 +136,9 @@ fi;
#%doc COPYING README
%changelog
* Thu Jun 07 2012 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.3.14-2
- Remove SysV init script
* Wed Apr 04 2012 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.3.14-1
- Update to sblim-sfcb-1.3.14