[csw-devel] SF.net SVN: gar:[10517] csw/mgar/pkg/cswclassutils/trunk

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Jul 13 19:45:40 CEST 2010


Revision: 10517
          http://gar.svn.sourceforge.net/gar/?rev=10517&view=rev
Author:   wahwah
Date:     2010-07-13 17:45:39 +0000 (Tue, 13 Jul 2010)

Log Message:
-----------
cswclassutils: Support for the removal of custom manifests.

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/Makefile
    csw/mgar/pkg/cswclassutils/trunk/checksums
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf

Property Changed:
----------------
    csw/mgar/pkg/cswclassutils/trunk/Makefile

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2010-07-13 14:26:33 UTC (rev 10516)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2010-07-13 17:45:39 UTC (rev 10517)
@@ -1,4 +1,4 @@
-# $Id$
+# $HeadURL$
 
 GARNAME = cswclassutils
 GARVERSION = 1.38
@@ -27,7 +27,8 @@
 PROTOTYPE_USER_cas = bin
 PROTOTYPE_GROUP_cas = sys
 
-CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-missing-cswinitsmf-class|/opt/csw/etc/init.d/csw.smf.sample|class=none
+CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-missing-cswinitsmf-class
+CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-wrong-location
 CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-wrong-location|/opt/csw/etc/init.d/csw.smf.sample
 
 include gar/category.mk


Property changes on: csw/mgar/pkg/cswclassutils/trunk/Makefile
___________________________________________________________________
Modified: svn:keywords
   - Id
   + HeadURL

Modified: csw/mgar/pkg/cswclassutils/trunk/checksums
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/checksums	2010-07-13 14:26:33 UTC (rev 10516)
+++ csw/mgar/pkg/cswclassutils/trunk/checksums	2010-07-13 17:45:39 UTC (rev 10517)
@@ -1,9 +1,9 @@
 48a97af56d55bc90ce90303228ed8cc3  COPYING
 9846081f8109dc9149dc026b89fbf137  CSWcswclassutils.i.cswcpsampleconf
-25f1f5a680a6dc118d2c54333703974f  CSWcswclassutils.i.cswcrontab
+efd19a09c355319c7d649885e4f9f76e  CSWcswclassutils.i.cswcrontab
 5e2ae2c6bd828061f86d84f09087b06a  CSWcswclassutils.i.cswetcservices
 e19dc831fd25be25706febc428607993  CSWcswclassutils.i.cswinetd
-6abb13158fee906870d1d68dc0fae6f3  CSWcswclassutils.i.cswinitsmf
+a366d67b53662fc1182a4f1a94df1ef2  CSWcswclassutils.i.cswinitsmf
 a667515489aafc81d41159765faf698f  CSWcswclassutils.i.cswmigrateconf
 8ab721535d43dcef702538d394e7a2ce  CSWcswclassutils.i.cswpostmsg
 0fc6128391af4c9aebf72b84755532cb  CSWcswclassutils.i.cswpreserveconf
@@ -11,10 +11,10 @@
 4f816acb06e8f95add6faf8607859da2  CSWcswclassutils.i.cswtexinfo
 e906a50bc2d82e341f78d582f32ecb88  CSWcswclassutils.i.cswusergroup
 d278a28a6f901c4ff5f07c583b4cff3d  CSWcswclassutils.r.cswcpsampleconf
-b452d4e6b95df03b6b00c6e980bb1004  CSWcswclassutils.r.cswcrontab
+f988248725a4607110a13820a005b72f  CSWcswclassutils.r.cswcrontab
 d60261ddc46e2cc83ecbbfc586a7e686  CSWcswclassutils.r.cswetcservices
 9039ea60ad4c3f8994205fb242a49a72  CSWcswclassutils.r.cswinetd
-791db9c2f6685aca67043820d260fc60  CSWcswclassutils.r.cswinitsmf
+8c48bf822a51499535c1346edcd638ae  CSWcswclassutils.r.cswinitsmf
 f7a2a10bbf0f88c1909a31141e6d83ce  CSWcswclassutils.r.cswmigrateconf
 76a18fed9174724f866ede53edda41fc  CSWcswclassutils.r.cswpostmsg
 96453922952c92c6c5a024e54ed8525f  CSWcswclassutils.r.cswpreserveconf

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2010-07-13 14:26:33 UTC (rev 10516)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2010-07-13 17:45:39 UTC (rev 10517)
@@ -237,6 +237,8 @@
     if [ "$daemon" = "yes" -a "$AUTOENABLE" != "no" -a "$AUTOENABLE" != "false" ]; then
       load_smf_service_state "$FMRI/$service"
       if [ "$SMF_STATE" = "enabled" ]; then
+        echo "Clearing svc:/$FMRI/$service in case it's in the maintenance state..."
+        /usr/sbin/svcadm clear svc:/$FMRI/$service > /dev/null 2>&1
         echo Enabling svc:/$FMRI/$service ...
         /usr/sbin/svcadm enable svc:/$FMRI/$service > /dev/null 2>&1
       fi

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf	2010-07-13 14:26:33 UTC (rev 10516)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf	2010-07-13 17:45:39 UTC (rev 10517)
@@ -16,6 +16,7 @@
 # 2009-04-24 Temporarily disabled the "persistent state" code until it can be used
 #            per service, not just per package
 # 2009-05-28 Enabled persistent state code again after receiving patch from Yann.
+# 2010-07-13 <maciej> Added support for removing custom manifests
 
 DEBUG=		# clear to disable debug, set to anything to enable
 
@@ -65,11 +66,41 @@
   echo PACKAGE: $PKGINST SMF: $smf
 fi
 
+# We need to find all the manifests before removing the files.  First, we'll
+# build the list of files to remove and we'll process them later.
+init_files=
+while read file
+do
+  init_files="${init_files} ${file}"
+done
+
 # Stop service
 if [ "$smf" = "yes" ]; then
+  manifests=
+  fmris=
+  for file in ${init_files}
+  do
+    if grep '^#MANIFEST' $file >/dev/null; then
+      new_manifest="`grep '^#MANIFEST' $file \
+                 | awk '{print $2}'`"
+      manifests="${manifests} ${new_manifest}"
+      # For foo FMRI, this outputs both foo and foo:default.  If both are
+      # attempted to be stopped, there are warnings printed to the screen, but
+      # they are harmless.
+      fmris="${fmris} `svccfg inventory ${new_manifest} \
+                       | tr '/' '\n' \
+                       | tail -1`"
+    fi
+  done
+
   # Find out FMRI complete with service name
-  FMRI=`grep ${PKGINST}$ /var/sadm/install/contents | grep "^/var/opt/csw/svc/manifest" | egrep '\.xml ' | cut -d'/' -f7- | awk -F'.xml' '{print $1}'`
-  for i in `echo $FMRI | tr '\n' ' '`
+  FMRI="`grep ${PKGINST}$ /var/sadm/install/contents \
+      | grep '^/var/opt/csw/svc/manifest' \
+      | egrep '\.xml ' \
+      | cut -d'/' -f7- \
+      | awk -F'.xml' '{print $1}'` \
+      ${fmris}"
+  for i in ${FMRI}
   do
     save_smf_state "$i"
     echo "Disabling svc:/$i ..."
@@ -89,7 +120,7 @@
 
 # Remove files in class cswinitsmf
 echo "Removing class <cswinitsmf> ..."
-while read file
+for file in ${init_files}
 do
   echo $file
   if [ -d $file ]; then


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list