#!/bin/bash ############################################################################## # DOCUMENTATION ############################################################################## # # PREREQUISITES # ------------- # # To use this script, your "master" SVN repository should have this layout: # # root # DRUPAL-5 # core # tags # trunk # sites -> ../sites (symlink) # profiles --> ../profiles (symlink) # profiles # tags # trunk # someProfile # anotherProfile # # When you branch or tag, you should update the svn:externals defitions to # point to tags instead of trunks. You may want to try this script: # http://svn.collab.net/repos/svn/trunk/contrib/client-side/svncopy/. # # # WHAT DOES IT DO? # ---------------- # # This script should be applied on a checkout of a fresh (empty) repository # that will be used for a Drupal project. It will checkout Drupal core and the # desired install profile from your master SVN repository. # Then it will create the necessary "sites" directory structure, including # sites/foo.com, symlink sites/default to sites/foo.com and set the svn:ignore # property on sites/foo.com/settings.php (to allow this site to work on any # host). It will check out settings.php from cvs.drupal.org, but rename it to # default.settings.php, and check that in into the repository. You'll have to # copy this file and name it settings.php on each host you wish to install # this site on. # Finally, it updates the repository to get Drupal core and the install # profile from the master SVN repository. # ############################################################################## ############################################################################## # Settings. ############################################################################## # URL of "master" SVN repository that contains Drupal core. repository=svn://dev.wimleers.com/drupalbase # Either DRUPAL4-7, DRUPAL-5 or DRUPAL-6. core_version=DRUPAL-6 # The name of the profile that should be checked out. profile_name=basic # The main URL for this project. site=foo.com ############################################################################## # Do the magic. ############################################################################## # Step 0: svn update before doing anything, you have to be up-to-date before # you can commit property changes. svn up # Step 1: import Drupal core through svn:externals. echo "core $repository/$core_version/core/trunk" > prop.tmp svn propset svn:externals . -F prop.tmp svn ci -m "Imported the trunk of Drupal core version $core_version through svn:externals." # Step 2: import the desired install profile through svn:externals. svn mkdir profiles echo "$profile_name $repository/$core_version/profiles/$profile_name/trunk" > prop.tmp svn propset svn:externals profiles -F prop.tmp svn ci -m "Imported the trunk of the $profile_name profile for $core_version through svn:externals." # Step 3: create the necessary sites directory structure. svn mkdir sites svn mkdir sites/all svn mkdir sites/all/modules svn mkdir sites/$site svn mkdir sites/$site/modules svn mkdir sites/$site/themes ln -s ../../files sites/$site/files # Symlink sites/$site/files to ../../files. svn add sites/$site/files ln -s $site sites/default # Symlink sites/default to $site. svn add sites/default svn ci -m "Created the sites directory structure." # Step 4: ignore sites/$site/settings.php echo "settings.php" > prop.tmp svn propset svn:ignore sites/$site -F prop.tmp svn ci -m "Configured SVN to ignore sites/$site/settings.php." # Step 4: import the default settings.php from cvs.drupal.org and name it default.settings.php (like in Drupal 6). cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal export -r $core_version -d sites/$site drupal/sites/default if [ ! `echo $core_version | grep -e "^DRUPAL-6$"` ] then # Rename it to default.settings.php, this is fixed since Drupal 6. mv sites/$site/settings.php sites/$site/default.settings.php fi svn add sites/$site/default.settings.php svn ci -m "Imported default settings.php for Drupal core version $core_version from cvs.drupal.org." # Step 5: create a files directory and add the .htaccess for it. svn mkdir files chmod 777 files # TODO get the .htaccess file! svn add files/.htacces svn ci -m "Created files directory and files/.htaccess." # Step 6: now do an svn update to get the sources from the external repositories. svn up # Cleanup. rm prop.tmp