SPECS: eqnx.spec - standard chkconfig and rc-scripts usage

glen glen at pld-linux.org
Sun Apr 16 23:41:02 CEST 2006


Author: glen                         Date: Sun Apr 16 21:41:02 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- standard chkconfig and rc-scripts usage

---- Files affected:
SPECS:
   eqnx.spec (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: SPECS/eqnx.spec
diff -u SPECS/eqnx.spec:1.6 SPECS/eqnx.spec:1.7
--- SPECS/eqnx.spec:1.6	Sun Apr 16 23:37:33 2006
+++ SPECS/eqnx.spec	Sun Apr 16 23:40:54 2006
@@ -10,6 +10,7 @@
 # Source0-md5:	3b335ac7f525036ad3147907adcd0ec8
 Patch0:		%{name}-misc.patch
 URL:		http://www.equinox.com/
+BuildRequires:	rpmbuild(macros) >= 1.268
 ExclusiveOS:	Linux
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -45,47 +46,28 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%preun
-# check driver usage.  If ports in use, disallow the remove
-if [ -e /sbin/chkconfig ]
-then
-	/sbin/chkconfig eqnx
-	if [ $? != 0 ]
-	then
-		exit 0
-	fi
-fi
+%post
+/sbin/chkconfig --add eqnx
+%service eqnx restart
 
-if [ -f /etc/rc.d/init.d/eqnx ]
-then
-	/etc/rc.d/init.d/eqnx status > /dev/null 2>&1
-	if [ $? != 0 ]
-	then
+%preun
+if [ "$1" = 0 ]; then
+	# check driver usage.  If ports in use, disallow the remove
+	/sbin/service eqnx status > /dev/null 2>&1
+	if [ $? != 0 ]; then
 		echo "eqnx driver in use, unable to unload"
 		echo "Please stop all processes running on SST ports"
 		exit 1
 	fi
-fi
 
-# stop the driver + remove device files
-if [ -f /etc/rc.d/init.d/eqnx ]
-then
-	/etc/rc.d/init.d/eqnx stop
-fi
+	# stop the driver + remove device files
+	%service eqnx stop
+	/sbin/chkconfig --del eqnx
 
-# remove eqnx from startup scripts
-if [ -e /usr/sbin/eqnx-installrc ]
-then
+	# remove eqnx from startup scripts
 	/usr/sbin/eqnx-installrc -u
 fi
 
-%post
-echo "To complete installation of the Equinox SST product:"
-echo "   1. /etc/rc.d/init.d/eqnx start"
-echo "   2. ensure this script is invoked at boot-time"
-echo "	    (such as chkconfig --add eqnx, for redhat, etc.)"
-echo "   Refer to installation notes for more information".
-
 %files
 %defattr(644,root,root,755)
 %doc inst/INSTALL.TXT
@@ -109,6 +91,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.7  2006/04/16 21:40:54  glen
+- standard chkconfig and rc-scripts usage
+
 Revision 1.6  2006/04/16 21:37:33  glen
 - adapter
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/eqnx.spec?r1=1.6&r2=1.7&f=u



More information about the pld-cvs-commit mailing list