[csw-devel] SF.net SVN: gar:[11883] csw/mgar/pkg/apache2/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Dec 12 00:58:47 CET 2010


Revision: 11883
          http://gar.svn.sourceforge.net/gar/?rev=11883&view=rev
Author:   bdwalton
Date:     2010-12-11 23:58:46 +0000 (Sat, 11 Dec 2010)

Log Message:
-----------
apache2: add a postinstall script for CSWap2worker that will handle (re)starting it after install if required.

Modified Paths:
--------------
    csw/mgar/pkg/apache2/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/apache2/trunk/files/CSWap2worker.postinstall

Modified: csw/mgar/pkg/apache2/trunk/Makefile
===================================================================
--- csw/mgar/pkg/apache2/trunk/Makefile	2010-12-11 18:01:58 UTC (rev 11882)
+++ csw/mgar/pkg/apache2/trunk/Makefile	2010-12-11 23:58:46 UTC (rev 11883)
@@ -37,7 +37,7 @@
 # Standard package bits
 DISTFILES += CSWapache2.killproc cswapache2
 
-DISTFILES += CSWapache2.preinstall
+DISTFILES += CSWapache2.preinstall CSWap2worker.postinstall
 
 # Configuration templates
 DISTFILES += update20to22

Added: csw/mgar/pkg/apache2/trunk/files/CSWap2worker.postinstall
===================================================================
--- csw/mgar/pkg/apache2/trunk/files/CSWap2worker.postinstall	                        (rev 0)
+++ csw/mgar/pkg/apache2/trunk/files/CSWap2worker.postinstall	2010-12-11 23:58:46 UTC (rev 11883)
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# this is a special handler for the worker mpm of apache2.  As we ship
+# the init/smf script with the primary package (which provides the
+# default prefork mpm), there is no hook to auto-(re)start apache when
+# this package gets installed.  Unfortunately, the postinstall script
+# is the best way to handle this situation.
+
+CSW_PREFIX=/opt/csw
+AP2_PREFIX=$CSW_PREFIX/apache2
+AP2_BINDIR=$AP2_PREFIX/sbin
+AP2_HTTPD=$AP2_BINDIR/httpd
+AP2_CTRL=$AP2_BINDIR/apachectl
+AP2_CONF=/etc/opt/csw/apache2/httpd.conf
+SVCADM=/usr/sbin/svcadm
+
+# only worry about stop/start if we're not installing via jumpstart or
+# similar
+if [ -z "$PKG_INSTALL_ROOT" ]; then
+    [ ! -f "$AP2_CONF" ] && exit 0
+
+    # Source csw.conf, if it exists
+    if [ -f /opt/csw/etc/csw.conf ] ; then
+	. /opt/csw/etc/csw.conf
+    fi
+    if [ -f /etc/opt/csw/csw.conf ] ; then
+	. /etc/opt/csw/csw.conf
+    fi
+
+    daemon=yes
+    if [ "$autoenable_daemons" = "no" ]; then
+	daemon=no
+    fi
+    if [ "$autoenable_cswapache2" = "no" ]; then
+	daemon=no
+    elif [ "$autoenable_cswapache2" = "yes" ]; then
+	daemon=yes
+    fi
+
+    if [ "$daemon" = "yes" -a -x "$AP2_HTTPD" ]; then
+        if [ -x "$SVCADM" ]; then
+	    $SVCADM disable cswapache2
+	    $SVCADM enable cswapache2
+        elif [ -x "$AP2_CTRL" ]; then
+	    $AP2_CTRL -k stop
+	    $AP2_CTRL -k start
+        fi
+        sleep 2
+    fi
+fi
+
+exit 0


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