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

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Fri Oct 1 04:15:32 CEST 2010


Revision: 11114
          http://gar.svn.sourceforge.net/gar/?rev=11114&view=rev
Author:   bdwalton
Date:     2010-10-01 02:15:32 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
cswclassutils: update behaviour of ap2mod CAS to honour values from csw.conf

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

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2010-09-30 21:54:26 UTC (rev 11113)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2010-10-01 02:15:32 UTC (rev 11114)
@@ -1,7 +1,7 @@
 # $HeadURL$
 
 GARNAME = cswclassutils
-GARVERSION = 1.41
+GARVERSION = 1.42
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswap2mod
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswap2mod	2010-09-30 21:54:26 UTC (rev 11113)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswap2mod	2010-10-01 02:15:32 UTC (rev 11114)
@@ -2,13 +2,19 @@
 #
 # i.cswap2mod - Class action script for installing apache2 modules
 #
-# $Id$
-#
 # Written by Ben Walton
 #
 # 2010-09-29 First Release
 #
 
+# 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
+fi
+if [ -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
+fi
+
 AP2_PREFIX=/opt/csw/apache2
 AP2_BINDIR=$AP2_PREFIX/sbin
 AP2_LIBEXEC=$AP2_PREFIX/libexec
@@ -28,24 +34,46 @@
       MODFILE=`basename $dest`
       MODNAME=`echo $MODFILE | sed 's/mod_//; s/\.so$//'`
 
-      # This check ensures we have an httpd.conf where we expect it
-      # and that apxs is available.  This (hopefully) prevents us from
-      # doing anything if the local system has completely reworked the
-      # etc/ file structure
+      # Modules will be enabled by default, but a global kill switch
+      # is checked , followed by a module specific value.  Thus,
+      # either ap2_enable_modules or ap2_enable_suexec (for example)
+      # could disable activation of the suexec module.  The 
+      #
+      # This value is passed to apxs (-a: add, enable; -A: add,
+      # disable)
+      enmod=-a
+
+      if [ "$ap2_enable_modules" = "no" ]; then
+	  enmod=-A
+      fi
+
+      eval ap2_mod_specific="\$ap2_enable_$MODNAME"
+      if [ "$ap2_mod_specific" = "no" ]; then
+	  enmod=-A
+      elif [ "$ap2_mod_specific" = "yes" ]; then
+	  enmod=-a
+      fi
+
       if [ -f "$CONF" -a -x "$APXS" ]; then
-	  # Enable the module
+	  # Add the module module, optionally enabling it by default
 	  chroot $PKG_INSTALL_ROOT \
-	      $APXS -e -a -n $MODNAME $MODFILE
+	      $APXS -e $enmod -n $MODNAME $MODFILE
+	  conftouched=1
+      fi
+done
+
+if [ "$conftouched" = "1" ]; then
 	  cat <<END
 
 
-NOTICE: The $MODNAME module was enabled in httpd.conf but the server
-was not restarted.  Please modify httpd.conf as appropriate and
-restart apache.
+NOTICE: One or more LoadModule lines was added to your httpd.conf.
+Depending on your csw.conf settings for ap2_enable_modules or the
+ap2_enable_\$modulename they may be enabled.  Please review the
+changes, make any futher modifications and then restart apache as
+required.
 
 
 END
-      fi
-done
+fi
 
 exit 0

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswap2mod
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswap2mod	2010-09-30 21:54:26 UTC (rev 11113)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswap2mod	2010-10-01 02:15:32 UTC (rev 11114)
@@ -2,8 +2,6 @@
 #
 # r.cswap2mod - Class action script for removing apache2 modules
 #
-# $Id$
-#
 # Written by Ben Walton
 #
 # 2010-09-29 First Release
@@ -26,28 +24,27 @@
       MODFILE=`basename $dest`
       MODNAME=`echo $MODFILE | sed 's/mod_//; s/\.so$//'`
 
-      # This check ensures we have an httpd.conf where we expect it
-      # and that apxs is available.  This (hopefully) prevents us from
-      # doing anything if the local system has completely reworked the
-      # etc/ file structure
       if [ -f "$CONF" -a -x "$APXS" ]; then
 	  # Disable the module
 	  chroot $PKG_INSTALL_ROOT \
 	      $APXS -e -A -n $MODNAME $MODFILE
+	  conftouched=1
+      fi
+
+      # Now actually remove the file.
+      /usr/bin/rm -f $dest || exit 2
+done
+
+if [ "$conftouched" = "1" ]; then
 	  cat <<END
 
 
-NOTICE: The $MODNAME module was disabled in httpd.conf but the server
-was not restarted.  Please modify httpd.conf as appropriate and
-restart apache.
+NOTICE: One or more apache modules was disabled in your apache
+configuration.  Please review these changes and restart apache as
+required.
 
 
 END
-      fi
+fi
 
-      # Now actually remove the file.
-      /usr/bin/rm -f $dest || exit 2
-
-done
-
 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