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

bonivart at users.sourceforge.net bonivart at users.sourceforge.net
Thu May 28 15:14:11 CEST 2009


Revision: 5084
          http://gar.svn.sourceforge.net/gar/?rev=5084&view=rev
Author:   bonivart
Date:     2009-05-28 13:14:11 +0000 (Thu, 28 May 2009)

Log Message:
-----------
cswclassutils: add MANIFEST tweak to cswinitsmf (custom manifests) (#3636)

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

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-28 12:39:59 UTC (rev 5083)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-28 13:14:11 UTC (rev 5084)
@@ -1,5 +1,5 @@
 GARNAME = cswclassutils
-GARVERSION = 1.12
+GARVERSION = 1.13
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.csw.smf.sample
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.csw.smf.sample	2009-05-28 12:39:59 UTC (rev 5083)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.csw.smf.sample	2009-05-28 13:14:11 UTC (rev 5084)
@@ -8,7 +8,7 @@
 # Written by Peter Bonivart
 #
 # 2008-04-22 First release
-# 2009-05-28 Add AUTOENABLE
+# 2009-05-28 Add AUTOENABLE, MANIFEST
 #
 # Usage
 # -----
@@ -52,9 +52,12 @@
 ##RC_SLEV 3          # Run levels that should have a start script symlink
 ##FMRI network       # FMRI path for service (S10+), the example would give
 #                      an FMRI of "svc:/network/cswfoo:default"
-##AUTOENABLE no	     # Will not enable SMF service regardless of local csw.conf,
-#                      use when a package needs setup before being useful,
-#                      would otherwise leave service in maintainance mode
+##AUTOENABLE yes     # If set to no will not enable SMF service regardless of
+#                      local csw.conf, use when a package needs setup before
+#                      being useful, would otherwise leave service in
+#                      maintenance mode
+##MANIFEST /absolute/path/to/manifest   # If set, use this manifest instead
+#                      of autogenerating one (default)
 
 case "$1" in
   start)

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2009-05-28 12:39:59 UTC (rev 5083)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2009-05-28 13:14:11 UTC (rev 5084)
@@ -16,7 +16,8 @@
 #            per service, not just per package
 # 2009-05-28 Enabled persistent state code again after receiving patch from Yann.
 #            Support AUTOENABLE to force no start regardless of
-#            local csw.conf (Bug ID 0003635)
+#            local csw.conf (Bug ID 0003635).
+#            Support custom manifests (Bug ID 0003636)
 
 DEBUG=		# clear to disable debug, set to anything to enable
 SVCDIR=/var/opt/csw/svc
@@ -112,10 +113,16 @@
     /usr/bin/chmod 755 $SVCDIR/method/svc-$service
     /usr/bin/chown root:bin $SVCDIR/method/svc-$service
 
-    # Creating manifest
-    echo Creating manifest ...
-    # Add first part of manifest
-    cat > $SVCDIR/manifest/$FMRI/$service.xml << EOF
+    MANIFEST=
+    if [ "`grep '^#MANIFEST' $dest`" ]; then
+      MANIFEST=`grep '^#MANIFEST' $dest | awk '{print $2}'`
+    fi
+    if [ ! "$MANIFEST" ]; then
+      # Creating manifest
+      echo Creating manifest ...
+      # Add first part of manifest
+      MANIFEST=$SVCDIR/manifest/$FMRI/$service.xml
+      cat > $MANIFEST << EOF
 <?xml version='1.0'?>
 <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
 <!--
@@ -163,9 +170,9 @@
 
 EOF
 
-    # Add restart option to manifest if service script supports it
-    if [ "`/usr/bin/egrep 'restart.?\)' $SVCDIR/method/svc-$service`" ]; then
-      cat >> $SVCDIR/manifest/$FMRI/$service.xml << EOF
+      # Add restart option to manifest if service script supports it
+      if [ "`/usr/bin/egrep 'restart.?\)' $SVCDIR/method/svc-$service`" ]; then
+        cat >> $MANIFEST << EOF
   <exec_method
     type='method'
     name='restart'
@@ -174,11 +181,11 @@
   </exec_method>
 
 EOF
-    fi
+      fi
 
-    # Add refresh option to manifest if service script supports it
-    if [ "`/usr/bin/egrep 'refresh.?\)' $SVCDIR/method/svc-$service`" ]; then
-      cat >> $SVCDIR/manifest/$FMRI/$service.xml << EOF
+      # Add refresh option to manifest if service script supports it
+      if [ "`/usr/bin/egrep 'refresh.?\)' $SVCDIR/method/svc-$service`" ]; then
+        cat >> $MANIFEST << EOF
   <exec_method
     type='method'
     name='refresh'
@@ -187,21 +194,29 @@
   </exec_method>
 
 EOF
-    fi
+      fi
 
-    # Add last part of manifest
-    cat >> $SVCDIR/manifest/$FMRI/$service.xml << EOF
+      # Add last part of manifest
+      cat >> $MANIFEST << EOF
 </service>
 
 </service_bundle>
 EOF
-    /usr/sbin/installf -c cswinitsmf $PKGINST $SVCDIR/manifest/$FMRI/$service.xml f 644 root bin
-    /usr/bin/chmod 644 $SVCDIR/manifest/$FMRI/$service.xml
-    /usr/bin/chown root:bin $SVCDIR/manifest/$FMRI/$service.xml
+      /usr/sbin/installf -c cswinitsmf $PKGINST $MANIFEST f 644 root bin
+      /usr/bin/chmod 644 $MANIFEST
+      /usr/bin/chown root:bin $MANIFEST
+    else
+      # Custom manifest
+      echo Using custom manifest ...
+    fi
 
+    if [ "$DEBUG" ]; then
+      echo MANIFEST: $MANIFEST
+    fi
+
     # Register with SMF
     echo Configuring service in SMF ...
-    /usr/sbin/svccfg import $SVCDIR/manifest/$FMRI/$service.xml > /dev/null 2>&1
+    /usr/sbin/svccfg import $MANIFEST > /dev/null 2>&1
     /usr/sbin/svcadm disable svc:/$FMRI/$service > /dev/null 2>&1
     echo $PKGINST is using Service Management Facility. The FMRI is svc:/$FMRI/$service:default
 


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