Updated Drupal module checkout package
May 28 2009
Early this year I posted a short shell script for checking out modules from Drupal.org's CVS repository. After doing several merges and branches, I decided I'd better re-write the script to avoid using -r HEAD
when checking out from HEAD.
The revised version of the script now looks like this. You can grab the attached zip file if you want to use the script yourself.
#!/bin/bash
#####################################################################
# This script checks out a contrib module.
# It sets up the environment first, and then does a CVS login and
# a CVS checkout.
#####################################################################
# Uncomment and change this if you don't want to set the env var.
#DRUPAL_USER='mbutcher'
if [[ $# == 0 ]]; then
echo "Usage: $0 module_name [branch_or_tag]"
echo " "
echo " module_name: "
echo " Module name must be the name of the module in Drupal's CVS repo."
echo " branch_or_tag: "
echo " If no branch/tag is specified, HEAD will be used."
echo " "
echo "Example: "
echo " $0 cacheexclude DRUPAL-6--2"
echo " "
exit 1;
fi
TAG='HEAD';
if [[ $# > 1 ]]; then
TAG=$2;
fi
# This directory will be created, and then used to house the
# new code.
dest="./$1/$TAG"
mkdir -p $dest
cd $dest
export CVSROOT=:pserver:$DRUPAL_USER@cvs.drupal.org:/cvs/drupal-contrib
cvs login
if [[ $# == 1 ]]; then
echo "Checking out $1 from HEAD (no tag used)"
cvs -z6 checkout -d $1 contributions/modules/$1
else
echo "Checking out $1 with revision $TAG"
cvs -z6 checkout -r $TAG -d $1 contributions/modules/$1
fi
The main change is this last conditional, which now avoids using -r
if no branch is explicitly set.
<!--break-->