#!/bin/sh # Argument 1 ($1) is the name to use for the test installation. This value # will be used both for the directory of the installation as well as the # MySQL username and database name. ########################################################################### # Configuration options: # # Webroot directory # This should be a full path to the root where you # want your Drupal test installs to go. This directory should be accessible # to your webserver and within your web server's webroot. # Do NOT include a trailing slash. # Example: # WEBROOT_DIR="/var/www" WEBROOT_DIR="/drupal" # Webroot # Enter the web URL of your testing site. This value is not used by the script # itself but will be printed as output of the script so that you can copy # the url and paste it into your browser to complete the installation of # your test site. Do not use a trailing slash. # Example: # WEBROOT="http://www.example.com" WEBROOT="http://localhost" # MySQL user # Enter a valid MySQL username which has permission to create users # and databases. # Example: # MYSQL_ROOT="root" MYSQL_ROOT="root" ########################################################################### # DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ########################################################################### # Make sure there is 1 and only 1 argument. if [ $# -ne 1 ] then echo "Error in $0 - Invalid Argument Count" echo "Syntax: $0 test_installation_name" exit fi CURRENT_DIRECTORY=`pwd` cd $WEBROOT_DIR mkdir $1 #chmod a+r $1 cd $1 # Check out Drupal core 5.x-dev cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-5 drupal cd drupal mkdir sites/all/modules # Check out contributed modules. cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d sites/all/modules/project contributions/modules/project cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d sites/all/modules/project_issue contributions/modules/project_issue cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5 -d sites/all/modules/codefilter contributions/modules/codefilter cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5 -d sites/all/modules/cvslog contributions/modules/cvslog cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5 -d sites/all/modules/devel contributions/modules/devel cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5 -d sites/all/modules/comment_upload contributions/modules/comment_upload # Check out drupalorg_testing install profile. cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d profiles/drupalorg_testing contributions/profiles/drupalorg_testing # Create the files directory mkdir files # Set proper permissions on site directory structure. cd $WEBROOT_DIR #chmod -R a+r $1 # Depending on your configuration you might want to change these permissions to be more restrictive chmod a+w $1/drupal/sites/default/settings.php chmod a+w $1/drupal/files # Generate a simple MySQL script in the current working directory. cd $CURRENT_DIRECTORY cp testing_mysql_create_user_and_database_template.sql testing_mysql_create_user_and_database_$1.sql sed -i -e "s/installation_name/$1/g" testing_mysql_create_user_and_database_$1.sql # Create a random password to use as the database password. RPASS=`cat /dev/urandom | strings -n 4 | head -4 | sed -e 'H;$!d;x;s/\n//g' | sed -e 's/[^A-Za-z,;_-]//g'` sed -i -e "s/passwordGoesHere/$RPASS/g" testing_mysql_create_user_and_database_$1.sql # Print instructions to shell that user can use to generate the test user and database echo echo echo A file with MySQL statements has bee created in the current directory. The name echo of this file is testing_mysql_create_user_and_database_$1.sql echo The statements in this file will be used to create your test user and database. echo You probably should delete this file when you are finished setting up your echo test site. echo mysql --user=$MYSQL_ROOT -p < testing_mysql_create_user_and_database_$1.sql echo echo To finish installing your site, you need to run the web based Drupal echo installer. echo Go to the following URL to finish installation: echo $WEBROOT/$1/drupal echo echo Use the information below where requested: echo Installation profile: Drupal.org testing echo Database type: mysql echo Database name: $1 echo Database username: $1 echo Database password: $RPASS