[csw-devel] SF.net SVN: gar:[11679] csw/mgar/pkg/apache2/branches/fs-rework

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Nov 21 22:14:06 CET 2010


Revision: 11679
          http://gar.svn.sourceforge.net/gar/?rev=11679&view=rev
Author:   bdwalton
Date:     2010-11-21 21:14:06 +0000 (Sun, 21 Nov 2010)

Log Message:
-----------
apache2/fs-rework: update the config file template handling, adding migration from old location if necessary

Modified Paths:
--------------
    csw/mgar/pkg/apache2/branches/fs-rework/Makefile
    csw/mgar/pkg/apache2/branches/fs-rework/files/build_cas_template

Modified: csw/mgar/pkg/apache2/branches/fs-rework/Makefile
===================================================================
--- csw/mgar/pkg/apache2/branches/fs-rework/Makefile	2010-11-21 21:01:11 UTC (rev 11678)
+++ csw/mgar/pkg/apache2/branches/fs-rework/Makefile	2010-11-21 21:14:06 UTC (rev 11679)
@@ -243,7 +243,7 @@
 
 post-merge: create-templates
 	@echo "  => Creating template files and CAS shell scripts..."
-	@( cd $(PKGROOT)/opt/csw/apache2/etc; \
+	@( cd $(PKGROOT)/etc/opt/csw/apache2/; \
 		for f in *conf extra/* mime* magic*; do \
 			echo "...$$f"; \
 			mv $$f $$f.CSW; \

Modified: csw/mgar/pkg/apache2/branches/fs-rework/files/build_cas_template
===================================================================
--- csw/mgar/pkg/apache2/branches/fs-rework/files/build_cas_template	2010-11-21 21:01:11 UTC (rev 11678)
+++ csw/mgar/pkg/apache2/branches/fs-rework/files/build_cas_template	2010-11-21 21:14:06 UTC (rev 11679)
@@ -10,29 +10,35 @@
 CONF_FILE=\$AP2_CONF/$1
 
 if [ "\$1" = install ]; then
-   if [ ! -f "\$CONF_FILE" ]; then
+   if [ -f "\$NEW_CONF_FILE" ]; then
+      # existing 2.2.x install with migrated config.
+      echo "Doing nothing.  Config file \$NEW_CONF_FILE in place already."
+   elif [ -f "\$OLD_CONF_FILE" ]; then
+      # migrate old config, ensure it's updated
+      cp -p \$OLD_CONF_FILE \$NEW_CONF_FILE
+      if [ -n "\`grep mod_auth.so \$NEW_CONF_FILE\`" ]; then
+         echo "Updating the syntax to 2.2 format though..." >&2
+         \${PIR}/\$AP2_DIR/sbin/update20to22 \$NEW_CONF_FILE >&2
+      fi
+   else
+      # so, we're not an existing or 'needs migration' install, we must
+      # install from the templates.
       echo "Installing $1 from CSW template." >&2
-      cp -p \$CONF_FILE.CSW \$CONF_FILE
+      cp -p \$NEW_CONF_FILE.CSW \$NEW_CONF_FILE
       perl -pi \
 	-e "s/#*ServerName.*www.example.com/ServerName \`hostname\`/;" \
 	-e "s/#*ServerAdmin you\@example.com/ServerAdmin root\@\`hostname\`/;" \
 	-e "s/^User.*daemon/User nobody/;" \
 	-e "s/^Group.*daemon/Group nobody/;" \
 	-e 's/^(LoadModule.*suexec.*)/#\$1/;' \
-	-e 's/^#(Include.*httpd-mpm.conf)/\$1/;' \$CONF_FILE
+	-e 's/^#(Include.*httpd-mpm.conf)/\$1/;' \$NEW_CONF_FILE
 
-      chown root:bin \$CONF_FILE
-      chmod 644 \$CONF_FILE
-   else
-      echo "Not updating $1.  It already exists." >&2
-      if [ -n "\`grep mod_auth.so \$CONF_FILE\`" ]; then
-         echo "Updating the syntax to 2.2 format though..." >&2
-         \${PIR}/\$AP2_DIR/sbin/update20to22 \$CONF_FILE >&2
-      fi
+      chown root:bin \$NEW_CONF_FILE
+      chmod 644 \$NEW_CONF_FILE
    fi
 else
    echo "Not removing $1." >&2
    # preserve ourselves with no changes
-   cat \$CONF_FILE
+   cat \$NEW_CONF_FILE
 fi
 EOF


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