[csw-devel] SF.net SVN: gar:[4447] csw/mgar/pkg/cswclassutils/trunk
bonivart at users.sourceforge.net
bonivart at users.sourceforge.net
Thu Apr 23 16:10:50 CEST 2009
Revision: 4447
http://gar.svn.sourceforge.net/gar/?rev=4447&view=rev
Author: bonivart
Date: 2009-04-23 14:10:50 +0000 (Thu, 23 Apr 2009)
Log Message:
-----------
cswclassutils: fix bugs in 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-04-23 11:30:21 UTC (rev 4446)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile 2009-04-23 14:10:50 UTC (rev 4447)
@@ -1,5 +1,5 @@
GARNAME = cswclassutils
-GARVERSION = 1.6
+GARVERSION = 1.7
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-04-23 11:30:21 UTC (rev 4446)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinitsmf 2009-04-23 14:10:50 UTC (rev 4447)
@@ -9,6 +9,7 @@
# 2009-03-28 Added support for refresh
# 2009-04-21 Do not create rc links unless enabled (Bug ID 0003633),
# Persistent state across upgrades (Bug ID 0003634)
+# 2009-04-22 Fix bug when starting packages with multiple services (Ihsan Dogan)
DEBUG= # clear to disable debug, set to anything to enable
SVCDIR=/var/opt/csw/svc
@@ -52,19 +53,6 @@
echo PACKAGE: $PKGINST SMF: $smf
fi
-# Determine if service should be started or not
-daemon=yes
-
-if [ "$autoenable_daemons" = "no" ]; then
- daemon=no
-fi
-
-if [ "$autoenable_$service" = "no" ]; then
- daemon=no
-elif [ "$autoenable_$service" = "yes" ]; then
- daemon=yes
-fi
-
# Copy files, set up SMF
echo "Installing class <cswinitsmf> ..."
@@ -74,6 +62,18 @@
echo SRC: $src DEST: $dest
fi
service="`basename $dest`"
+
+ # Determine if service should be started or not
+ daemon=yes
+ if [ "$autoenable_daemons" = "no" ]; then
+ daemon=no
+ fi
+ if [ "$autoenable_$service" = "no" ]; then
+ daemon=no
+ elif [ "$autoenable_$service" = "yes" ]; then
+ daemon=yes
+ fi
+
if [ "$smf" = "yes" ]; then
# Copy the service script
/usr/bin/cp $src $dest || exit 2
@@ -197,6 +197,15 @@
/usr/sbin/svccfg import $SVCDIR/manifest/$FMRI/$service.xml > /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
+
+ # Start service
+ if [ "$daemon" = "yes" ]; 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
else
# Copy the service script
echo $dest
@@ -255,25 +264,16 @@
/usr/sbin/installf -c cswinitsmf $PKGINST /etc/rc$i.d/S$RC_SNUM$service=/etc/init.d/$service s
/bin/ln -s /etc/init.d/$service /etc/rc$i.d/S$RC_SNUM$service
done
+
+ # Start service
+ echo Starting $service ...
+ # fix permissions temporarily since 644 is used until verification
+ /usr/bin/chmod 744 /etc/init.d/$service
+ /etc/init.d/$service start > /dev/null 2>&1
fi
fi
done
-# Start service
-if [ "$daemon" = "yes" ]; then
- echo Starting $PKGINST ...
- if [ "$smf" = "yes" ]; then
- load_smf_service_state "$FMRI/$service"
- if [ "$SMF_STATE" = "enabled" ]; then
- /usr/sbin/svcadm enable svc:/$FMRI/$service > /dev/null 2>&1
- fi
- else
- # fix permissions temporarily since 644 is used until verification
- /usr/bin/chmod 744 /etc/init.d/$service
- /etc/init.d/$service start > /dev/null 2>&1
- fi
-fi
-
# we delete the smf state file as we don't need it anymore
rm -f "$SMF_STATE_FILE"
Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf 2009-04-23 11:30:21 UTC (rev 4446)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinitsmf 2009-04-23 14:10:50 UTC (rev 4447)
@@ -10,6 +10,7 @@
# 2009-01-07 Fixed bug with multiple services per package
# 2009-04-21 Added -s to svcadm disable, removed sleep (Bug ID 0003632),
# Persistent state across upgrades (Bug ID 0003634)
+# 2009-04-22 Fixed bug when stopping non-SMF services
DEBUG= # clear to disable debug, set to anything to enable
@@ -36,7 +37,6 @@
echo "$1 $SMF_STATE" >> "$SMF_STATE_FILE"
}
-
# 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
@@ -61,21 +61,26 @@
fi
# Stop service
-echo Stopping $PKGINST ...
-# 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' ' '`
-do
- if [ "$smf" = "yes" ]; then
+if [ "$smf" = "yes" ]; then
+ # 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' ' '`
+ do
save_smf_state
+ echo "Disabling svc:/$i ..."
/usr/sbin/svcadm -s disable svc:/$i
# Unregister with SMF
echo Unregister svc:/${i}:default with SMF ...
/usr/sbin/svccfg delete -f svc:/${i}:default
- else
- /etc/init.d/`basename $i` stop > /dev/null 2>&1
- fi
-done
+ done
+else
+ RC=`cat /var/sadm/install/contents | grep "s cswinitsmf" | grep ${PKGINST}$ | awk -F'=' '{print $1}'`
+ for i in `echo $RC | tr '\n' ' '`
+ do
+ echo Stopping $i ...
+ "$i" stop > /dev/null 2>&1
+ done
+fi
# Remove files in class cswinitsmf
echo "Removing class <cswinitsmf> ..."
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