SPECS: nps.spec - fix postun, adapter

glen glen at pld-linux.org
Thu Apr 20 19:10:48 CEST 2006


Author: glen                         Date: Thu Apr 20 17:10:48 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- fix postun, adapter

---- Files affected:
SPECS:
   nps.spec (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: SPECS/nps.spec
diff -u SPECS/nps.spec:1.11 SPECS/nps.spec:1.12
--- SPECS/nps.spec:1.11	Thu Apr 20 19:08:55 2006
+++ SPECS/nps.spec	Thu Apr 20 19:10:43 2006
@@ -17,6 +17,8 @@
 # Source0-md5:	5c843ff779f10722b314433b7e8f1210
 URL:		http://www.newisys.com/
 %{!?without_dist_kernel:BuildRequires: kernel-headers}
+Requires(post,preun):	/sbin/chkconfig
+Requires:	rc-scripts
 Requires:	sed >= 4.0
 # we only support linux
 ExclusiveOS:	Linux
@@ -54,15 +56,15 @@
 sed -i -e "s/<SWInstalledDate>.*</<SWInstalledDate>`date +%s`</" /etc/newisys/poci/swinventory.xml
 sed -i -e "s/<SWInstalledDate>.*</<SWInstalledDate>`date +%s`</" /etc/newisys/jnet/swinventory.xml
 
-if [ -e /etc/newisys/nws_mc/swinventory.xml ] ; then
+if [ -e %{_sysconfdir}/newisys/nws_mc/swinventory.xml ] ; then
 	sed -i -e "s/<SWInstalledDate>.*</<SWInstalledDate>`date +%s`</" /etc/newisys/nws_mc/swinventory.xml
 fi
 
 # need to add a file for JNET's ip address
-if [ ! -f /etc/newisys/jnet/jnet.conf ]; then
-	mkdir -p /etc/newisys/jnet
-	echo "169.254.101.2" >/etc/newisys/jnet/jnet.conf
-	chmod 600 /etc/newisys/jnet/jnet.conf
+if [ ! -f %{_sysconfdir}/newisys/jnet/jnet.conf ]; then
+	mkdir -p %{_sysconfdir}/newisys/jnet
+	echo "169.254.101.2" >%{_sysconfdir}/newisys/jnet/jnet.conf
+	chmod 600 %{_sysconfdir}/newisys/jnet/jnet.conf
 fi
 
 if ! lsmod | grep -q ^jnet; then
@@ -77,10 +79,10 @@
 	fi
 fi
 
-# need to add to /etc/hosts
+# need to add to %{_sysconfdir}/hosts
 # 169.254.101.2  sp.D332B385-5567-42e9-8D66-545897E8120A
-if ! grep -q "169.254.101.2.*sp" /etc/hosts; then
-	echo "169.254.101.2  sp.D332B385-5567-42e9-8D66-545897E8120A" >> /etc/hosts
+if ! grep -q "169.254.101.2.*sp" %{_sysconfdir}/hosts; then
+	echo "169.254.101.2 sp.D332B385-5567-42e9-8D66-545897E8120A" >> %{_sysconfdir}/hosts
 fi
 
 %preun
@@ -90,32 +92,34 @@
 cp -f /usr/sbin/nws_mc /usr/sbin/nws_mc.bk
 
 %postun
-# if poci DNE, this must be an uninstall
-if [ ! -f /usr/sbin/poci ]; then
-	mv /etc/init.d/poci.bk /etc/init.d/poci
-	mv /usr/sbin/nws_poci.bk /usr/sbin/nws_poci
-	mv /usr/sbin/nws_hb.bk /usr/sbin/nws_hb
-	mv /usr/sbin/nws_mc.bk /usr/sbin/nws_mc
-
-	# check to see if poci is running...if so, stop it
-	if ( ps -Af | grep -v "grep" | grep -q "poci" ); then
-		/etc/init.d/poci stop
-	fi
-
-	/sbin/chkconfig --add poci
-
-	rm -f /etc/init.d/poci
-	rm -f /usr/sbin/nws_poci
-	rm -f /usr/sbin/nws_hb
-	rm -f /usr/sbin/nws_mc
-
-	# need to remove jnet's file
-	rm -rf /etc/jnet
-
-	# need to remove to /etc/hosts
-	# 169.254.101.2  sp.D332B385-5567-42e9-8D66-545897E8120A
-	if grep -q "169.254.101.2.*sp" /etc/hosts; then
-		sed -i -e /169.254.101.2/d /etc/hosts
+if [ "$1" = 0 ]; then
+	# if poci DNE, this must be an uninstall
+	if [ ! -f %{_sbindir}/poci ]; then
+		mv %{_sysconfdir}/init.d/poci.bk %{_sysconfdir}/init.d/poci
+		mv %{_sbindir}/nws_poci.bk %{_sbindir}/nws_poci
+		mv %{_sbindir}/nws_hb.bk %{_sbindir}/nws_hb
+		mv %{_sbindir}/nws_mc.bk %{_sbindir}/nws_mc
+
+		# check to see if poci is running...if so, stop it
+		if ( ps -Af | grep -v "grep" | grep -q "poci" ); then
+			%{_sysconfdir}/init.d/poci stop
+		fi
+
+		/sbin/chkconfig --del poci
+
+		rm -f %{_sysconfdir}/init.d/poci
+		rm -f %{_sbindir}/nws_poci
+		rm -f %{_sbindir}/nws_hb
+		rm -f %{_sbindir}/nws_mc
+
+		# need to remove jnet's file
+		rm -rf %{_sysconfdir}/jnet
+
+		# need to remove to %{_sysconfdir}/hosts
+		# 169.254.101.2  sp.D332B385-5567-42e9-8D66-545897E8120A
+		if grep -q "169.254.101.2.*sp" %{_sysconfdir}/hosts; then
+			sed -i -e /169.254.101.2/d /etc/hosts
+		fi
 	fi
 fi
 
@@ -131,15 +135,15 @@
 %attr(755,root,root) %{_sbindir}/nws_hb
 %attr(755,root,root) %{_sbindir}/nws_poci
 %attr(754,root,root) /etc/rc.d/init.d/poci
-/etc/newisys/swinventory.xml
-/etc/newisys/poci/swinventory.xml
+%{_sysconfdir}/newisys/swinventory.xml
+%{_sysconfdir}/newisys/poci/swinventory.xml
 
 %files -n kernel-net-nps
 %defattr(644,root,root,755)
-/etc/newisys/jnet/swinventory.xml
+%{_sysconfdir}/newisys/jnet/swinventory.xml
 /lib/modules/%{_kernel_ver}/kernel/drivers/net/jnet_prs.*o
 
-/etc/newisys/nws_mc/swinventory.xml
+%{_sysconfdir}/newisys/nws_mc/swinventory.xml
 /lib/modules/%{_kernel_ver}/kernel/drivers/net/nws_mc.*o
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
@@ -148,6 +152,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.12  2006/04/20 17:10:43  glen
+- fix postun, adapter
+
 Revision 1.11  2006/04/20 17:08:55  glen
 - new bcond
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/nps.spec?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list