#!/bin/sh # Script for generating drupal multisite niceness # Space separated list of disabled sites: DISABLED="testing.mesh.funkyhat.net.drupal6" # Space separated list of sites with custom config files: CUSTOM="" # Location of custom config files: CUSTOMDIR="/home/matt/Websites/testing/customconfig" DRUPAL_DIR="/home/matt/Websites/testing/drupal6" DRUPAL_LUA_PATH="/home/matt/Websites/tools/drupal/drupal.lua" #Don't edit this, edit the other DISABLED="" VAR up there ^ DISABLED="all default "$DISABLED for VHOST in `find ${DRUPAL_DIR}/sites/ -mindepth 1 -maxdepth 1 \( -type d -or -type l \) -exec basename "{}" \;` ; do for SITE in $DISABLED ; do if [ $SITE = $VHOST ] then #Just calling continue here can't work, we're inside a child loop DIS=y fi done if [ "$DIS" = "y" ] then DIS="" continue fi echo "\$HTTP[\"host\"] =~ \"$VHOST\" { var.vhost_name = \"$VHOST\" server.document-root = \"$DRUPAL_DIR\" magnet.attract-physical-path-to = (\"${DRUPAL_LUA_PATH}\") \$HTTP[\"url\"] =~ \"^/sites/.*\" { \$HTTP[\"url\"] !~ \"^/sites/(`echo $VHOST| sed 's:\.:\\\.:g'`|all)/.*\" { url.access-deny = (\"\") } }" # This allows access to /sites/all and /sites/(this domain) which is all we need access to for SITE in $CUSTOM ; do if [ "$SITE" = "$VHOST" ] then cat $CUSTOMDIR/$SITE fi done echo "}" done