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

bonivart at users.sourceforge.net bonivart at users.sourceforge.net
Thu May 28 11:21:43 CEST 2009


Revision: 5082
          http://gar.svn.sourceforge.net/gar/?rev=5082&view=rev
Author:   bonivart
Date:     2009-05-28 09:21:43 +0000 (Thu, 28 May 2009)

Log Message:
-----------
cswclassutils: re-enable persistent state code (cswinitsmf)

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

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-28 09:09:51 UTC (rev 5081)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-05-28 09:21:43 UTC (rev 5082)
@@ -1,5 +1,5 @@
 GARNAME = cswclassutils
-GARVERSION = 1.10
+GARVERSION = 1.11
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2009-05-28 09:09:51 UTC (rev 5081)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf	2009-05-28 09:21:43 UTC (rev 5082)
@@ -18,22 +18,22 @@
 DEBUG=		# clear to disable debug, set to anything to enable
 SVCDIR=/var/opt/csw/svc
 
-#SMF_STATE_DIR="$PKG_INSTALL_ROOT/etc/opt/csw/preserve/$PKG"
-#SMF_STATE_FILE="$SMF_STATE_DIR/smf.state"
+SMF_STATE_DIR="$PKG_INSTALL_ROOT/etc/opt/csw/preserve/$PKG"
+SMF_STATE_FILE="$SMF_STATE_DIR/smf.state"
 
 # retrieve the previous state of a service identified by the given FRMI
-#load_smf_service_state ()
-#{
-#    SMF_STATE="disabled"
-#
-#    if [ -f "$SMF_STATE_FILE" ]; then
-#        set -- `/usr/bin/awk " \\\$1 == \"$1\" { print \\\$2 } " "$SMF_STATE_FILE"`
-#        if [ "$1" = "enabled" ]; then
-#            SMF_STATE="enabled"
-#        fi
-#    fi
-#}
+load_smf_service_state ()
+{
+    SMF_STATE="enabled"
 
+    if [ -f "$SMF_STATE_FILE" ]; then
+        set -- `/usr/bin/awk " \\\$1 == \"$1\" { print \\\$2 } " "$SMF_STATE_FILE"`
+        if [ "$1" = "disabled" ]; then
+            SMF_STATE="disabled"
+        fi
+    fi
+}
+
 # Source csw.conf, if it exists
 if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
   . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
@@ -204,11 +204,11 @@
 
     # Start service
     if [ "$daemon" = "yes" ]; then
-#      load_smf_service_state "$FMRI/$service"
-#      if [ "$SMF_STATE" = "enabled" ]; then
+      load_smf_service_state "$FMRI/$service"
+      if [ "$SMF_STATE" = "enabled" ]; then
         echo Enabling svc:/$FMRI/$service ...
         /usr/sbin/svcadm enable svc:/$FMRI/$service > /dev/null 2>&1
-#      fi
+      fi
     fi
   else
     # Copy the service script
@@ -279,7 +279,7 @@
 done
 
 # we delete the smf state file as we don't need it anymore
-#rm -f "$SMF_STATE_FILE"
+rm -f "$SMF_STATE_FILE"
 
 /usr/sbin/installf -f $PKGINST
 

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf	2009-05-28 09:09:51 UTC (rev 5081)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf	2009-05-28 09:21:43 UTC (rev 5082)
@@ -21,25 +21,25 @@
 # The following file is used to save the state of smf service upon
 # package removal
 # This allows to restore the service state across package upgrades.
-#SMF_STATE_DIR="$PKG_INSTALL_ROOT/etc/opt/csw/preserve/$PKG"
-#SMF_STATE_FILE="$SMF_STATE_DIR/smf.state"
+SMF_STATE_DIR="$PKG_INSTALL_ROOT/etc/opt/csw/preserve/$PKG"
+SMF_STATE_FILE="$SMF_STATE_DIR/smf.state"
 
 # The smf state file shouldn't be there at this time but we
 # delete it to be sure
-#rm -f "$SMF_STATE_FILE"
+rm -f "$SMF_STATE_FILE"
 
 # save the current service state for the given frmi
-#save_smf_state ()
-#{
-#    SMF_STATE=`/usr/sbin/svccfg -s "$1:default" listprop general/enabled | /usr/bin/awk '{ print $3 }'`
-#    if [ "$SMF_STATE" != "true" ]; then
-#        SMF_STATE="disabled"
-#    else
-#        SMF_STATE="enabled"
-#    fi
-#    [ -d "$SMF_STATE_DIR" ] || mkdir -p "$SMF_STATE_DIR"
-#    echo "$1 $SMF_STATE" >> "$SMF_STATE_FILE"
-#}
+save_smf_state ()
+{
+    SMF_STATE=`/usr/sbin/svccfg -s "$1:default" listprop general/enabled | /usr/bin/awk '{ print $3 }'`
+    if [ "$SMF_STATE" != "true" ]; then
+        SMF_STATE="disabled"
+    else
+        SMF_STATE="enabled"
+    fi
+    [ -d "$SMF_STATE_DIR" ] || mkdir -p "$SMF_STATE_DIR"
+    echo "$1 $SMF_STATE" >> "$SMF_STATE_FILE"
+}
 
 # Source csw.conf, if it exists
 if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
@@ -70,7 +70,7 @@
   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' ' '`
   do
-#    save_smf_state "$i"
+    save_smf_state "$i"
     echo "Disabling svc:/$i ..."
     /usr/sbin/svcadm disable -s svc:/$i
     # Unregister with SMF


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