SERIES="5 6"
# Get drupal major version
-function get_major {
+function drupal_get_major {
echo $1 | sed -e 's/\(^.\).*/\1/'
}
+# Check for existing installations
+function drupal_check_existing {
+ if [ -e "$BASE/drupal-$1" ]; then
+ echo "Folder $BASE/drupal-$1 already exist, skipping"
+ exit 1
+ fi
+}
+
# Deploy a fresh drupal tree
function drupal_deploy {
if [ "$#" != "1" ]; then
# Setup
new="$1"
cd $BASE
+ drupal_check_existing $new
# Deploy a fresh drupal tree
wget http://ftp.drupal.org/files/projects/drupal-$new.tar.gz
# Update all drupal instances in the host
function drupal_update {
for version in $SERIES; do
- # Setup base and sites folders
+ # Setup base folder
base="$BASE/drupal-$version"
+
+ if [ ! -d "$base/sites" ]; then
+ break
+ fi
+
+ # Setup site folders
cd $base/sites
drupals="`ls -I default -I all`"
# Setup
old="$1"
new="$2"
- old_major="`get_major $old`"
- new_major="`get_major $new`"
+ old_major="`drupal_get_major $old`"
+ new_major="`drupal_get_major $new`"
extra_folders=""
if [ "$old_major" != "$new_major" ]; then
echo "Major versions doesn't match"
exit 1
fi
+
+ drupal_check_existing $new
# Set drupal series
if [ "$new_major" == "4" ]; then