packages: ibmusbasm/ibmasm.init, ibmusbasm/ibmusbasm.spec - pldize initscri...

glen glen at pld-linux.org
Wed Jun 17 04:28:03 CEST 2009


Author: glen                         Date: Wed Jun 17 02:28:03 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- pldize initscript
- add soname to lib

---- Files affected:
packages/ibmusbasm:
   ibmasm.init (1.1 -> 1.2) , ibmusbasm.spec (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: packages/ibmusbasm/ibmasm.init
diff -u packages/ibmusbasm/ibmasm.init:1.1 packages/ibmusbasm/ibmasm.init:1.2
--- packages/ibmusbasm/ibmasm.init:1.1	Wed Jun 17 04:19:40 2009
+++ packages/ibmusbasm/ibmasm.init	Wed Jun 17 04:27:57 2009
@@ -1,121 +1,85 @@
-#!/bin/bash
+#!/bin/sh
 #
 # ibmasm        This shell script takes care of starting and stopping \
-#               the x64 IBM Remote Supervisor Adapter II daemon.
+#               the IBM Remote Supervisor Adapter II daemon.
 #
 # chkconfig: 2345 85 15
 # description: The IBM Remote Supervisor Adapter II interface daemon allows\
 #              software to interact with the Remote Supervisor Adapter II.\
 #
-### BEGIN INIT INFO
-# Provides:       ibmusbasm
-# Required-Start: $local_fs $syslog
-# Required-Stop:  $local_fs
-# Should-Start:
-# Should-Stop:
-# Default-Start:  2 3 4 5
-# Default-Stop:   0 1 6
-# Description:    IBM Remote Supervisor Adapter
-### END INIT INFO
+# processname:	ibmasm
+#
+# $Id$
 
-RETVAL=0
+# Source function library
+. /etc/rc.d/init.d/functions
 
-start () {
-	echo "  Starting IBM RSA II daemon "
+# Get service config - may override defaults
+[ -f /etc/sysconfig/ibmasm ] && . /etc/sysconfig/ibmasm
 
-	local pid=
-	# is it already running?
-	if [ -f /var/run/ibmusbasm.pid ]; then
-		local line p
-		read line < /var/run/ibmusbasm.pid
-		for p in $line ; do
-			[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid$p"
-		done
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/ibmasm ]; then
+		msg_already_running "IBM Remote Supervisor Adapter"
+		return
 	fi
 
-	#  if it's already running, return success
-	[ -n "${pid:-}" ] && return 0
-	
+	msg_starting "IBM Remote Supervisor Adapter"
 	# start the daemon in the background
-	/sbin/ibmasm > /dev/null 2>&1 &
-	
-	# wait for process to start
-	usleep 100000
-	# is it running?
-	if [ -f /var/run/ibmusbasm.pid ]; then
-		local line p
-		read line < /var/run/ibmusbasm.pid
-		for p in $line ; do
-			[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid$p"
-		done
-	fi
-	#  if not running, wait longer
-	if [ -z "${pid:-}" ]; then
-		sleep 1
-		# is it running?
-		if [ -f /var/run/ibmusbasm.pid ]; then
-			local line p
-			read line < /var/run/ibmusbasm.pid
-			for p in $line ; do
-				[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid$p"
-			done
-		fi
-		#  if still not running, return failure
-		[ -z "${pid:-}" ] && return 3
-	fi
-	# double check that it's running
-	touch /var/lock/subsys/ibmasm
+	daemon --fork /sbin/ibmasm
 	RETVAL=$?
-	return $RETVAL
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ibmasm
 }
 
-stop () {
-	echo "  Stopping IBM RSA II daemon "
-
-	# Find pid.
-	local pid=""
-	if [ -f /var/run/ibmusbasm.pid ]; then
-		local line p
-		read line < /var/run/ibmusbasm.pid
-		for p in $line ; do
-			[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid$p"
-		done
-	fi
-	if [ -z "$pid" ]; then
-		pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
-		pidof -o $$ -o $PPID -o %PPID -x ibmusbasm`
+stop() {
+	if [ ! -f /var/lock/subsys/ibmasm ]; then
+		msg_not_running "IBM Remote Supervisor Adapter"
+		return
 	fi
 
-	# Kill it.
-	if [ -n "${pid:-}" ]; then
-		if [ -d "/proc/$pid" ]; then
-			# TERM first, then KILL if not dead
-			kill -SIGTERM $pid >/dev/null 2>&1
-			usleep 100000
-			if [ -d "/proc/$pid" ] ; then
-				sleep 3
-				if [ -d "/proc/$pid" ] ; then
-					RETVAL=1
-				fi
-			fi
-		fi
-	else
-		RETVAL=1
+	# Stop daemons.
+	msg_stopping "IBM Remote Supervisor Adapter"
+	killproc ibmasm
+	rm -f /var/lock/subsys/ibmasm
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/ibmasm ]; then
+		msg_not_running "IBM Remote Supervisor Adapter"
+		RETVAL=$1
+		return
 	fi
-	return $RETVAL
+
+	stop
+	start
 }
 
+RETVAL=0
 # See how we were called.
 case "$1" in
-    start)
-	start
+  start)
+  	start
 	;;
-    stop)
+  stop)
+  	stop
+	;;
+  restart)
 	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status ibmasm
+	RETVAL=$?
 	;;
-    *)
-        echo "Usage: ibmasm {start|stop}"
-        RETVAL=0
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
+	exit 3
 esac
 
 exit $RETVAL

================================================================
Index: packages/ibmusbasm/ibmusbasm.spec
diff -u packages/ibmusbasm/ibmusbasm.spec:1.5 packages/ibmusbasm/ibmusbasm.spec:1.6
--- packages/ibmusbasm/ibmusbasm.spec:1.5	Thu Apr  3 14:23:24 2008
+++ packages/ibmusbasm/ibmusbasm.spec	Wed Jun 17 04:27:57 2009
@@ -1,15 +1,14 @@
 # $Revision$, $Date$
-# TODO
-# - pldize initscript
 Summary:	IBM Remote Supervisor Adapter (RSA) II daemon
 Summary(pl.UTF-8):	Demon IBM Remote Supervisor Adapter (RSA) II
 Name:		ibmusbasm
 Version:	1.42
-Release:	1
+Release:	2
 License:	GPL
 Group:		Applications
 Source0:	ftp://ftp.software.ibm.com/systems/support/system_x/ibm_svc_rsa2_hlp242b_linux_32-64.tgz
 # Source0-md5:	8b08d5cf722c812e607f99ce852f62f7
+Source1:	ibmasm.init
 URL:		http://www-304.ibm.com/jct01004c/systems/support/supportsite.wss/docdisplay?lndocid=MIGR-5071676&brandind=5000008
 BuildRequires:	libusb-devel
 BuildRequires:	rpmbuild(macros) >= 1.228
@@ -51,7 +50,7 @@
 
 %build
 cd ibmusbasm-src/shlib
-%{__cc} %{rpmcflags} -D__IBMLINUX__ -fPIC -shared -I ../src -o libsysSp.so.1 uwiapi.c
+%{__cc} %{rpmcflags} -D__IBMLINUX__ -fPIC -shared -I ../src -Wl,-soname -Wl,libsysSp.so.1 -o libsysSp.so.1 uwiapi.c
 cd ../src
 %{__cc} %{rpmcflags} -I . -o ibmasm ibmasm.c -ldl
 
@@ -61,7 +60,7 @@
 install ibmusbasm-src/shlib/libsysSp.so.1 $RPM_BUILD_ROOT%{_libdir}
 install ibmusbasm-src/src/ibmasm $RPM_BUILD_ROOT%{_sbindir}
 install ibmusbasm-src/ibmspup ibmusbasm-src/ibmspdown $RPM_BUILD_ROOT%{_sbindir}
-install ibmasm.initscript $RPM_BUILD_ROOT/etc/rc.d/init.d/ibmasm
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ibmasm
 ln -s libsysSp.so.1 $RPM_BUILD_ROOT%{_libdir}/libsysSp.so
 
 %clean
@@ -83,6 +82,7 @@
 %defattr(644,root,root,755)
 %doc readme.txt
 %attr(754,root,root) /etc/rc.d/init.d/ibmasm
+%attr(755,root,root) %{_libdir}/libsysSp.so
 %attr(755,root,root) %{_libdir}/libsysSp.so.1
 %attr(755,root,root) %{_sbindir}/ibmasm
 %attr(755,root,root) %{_sbindir}/ibmspdown
@@ -94,6 +94,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.6  2009/06/17 02:27:57  glen
+- pldize initscript
+- add soname to lib
+
 Revision 1.5  2008/04/03 12:23:24  glen
 - initscript hooks
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ibmusbasm/ibmasm.init?r1=1.1&r2=1.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ibmusbasm/ibmusbasm.spec?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list