#!/bin/bash PLATFORMDIR=/home/drupal/core DBHOST=mysql0 DEVGROUP=drupaladm VHOSTSVNBASE=http://devel.egressive.com/egressive/egpuppet/trunk/virtualhosts/dev ADDPUPPETCONF=0 FIXMISSING=1 usage() { cat <&2 exit 1 fi if [ ! -d $docroot ] || [ ! -f "$docroot/update.php" ] ; then echo "Err: $docroot does not look like a valid Drupal DocumentRoot" >&2 exit 1 fi if ! id $user > /dev/null ; then echo "Err: User $user does not exist" >&2 exit 1 fi if ! getent group $group ; then echo "Err: Group id $group does not exist" >&2 exit 1 fi sitedir=$docroot/sites/$siteuri if [ -d "$sitedir" ] ; then echo "$sitedir already exists" >&2 exit 1 fi set -e # Checkout the site code svn co $svnuri $sitedir # Create a database for the user dbname=`echo "${user}__${platform}__${siteuri}" | sed -e 's/\./_/g'` ret=`egmakedb -H $DBHOST $user $dbname` eval "$ret" # Generate the site settings.php # Default for D6 default_settings=$docroot/sites/default/default.settings.php if [ ! -f $default_settings ] ; then # Default for D5 default_settings=$docroot/sites/default/settings.php fi # Create a drushrc.php cat < $sitedir/drushrc.php &2 exit 1 fi settings=$sitedir/settings.php sed -e "s/^\$db_url.*/\$db_url = 'mysql:\/\/$DBUSER:$DBPASS@$DBHOST\/$DBNAME';/" $default_settings > $settings cat >> $settings < $tmpfile < "$docroot", owner => "$user", } EOT svn import -m "egdrupaldeploy: Auto Puppet vhost conf ($siteuri)" $tmpfile $VHOSTSVNBASE/$siteuri.pp rm -v $tmpfile fi