aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2009-12-29 19:09:03 -0200
committerSilvio Rhatto <rhatto@riseup.net>2009-12-29 19:09:03 -0200
commit1b8b9da24e1337fcea57bcef67a45e35defba78b (patch)
treea69eb6d4bd8be48637986117bdc5e11bc55c512f /templates
parentc5fe52309bcb484a2e8b89186d8cb18b25517d2b (diff)
downloadpuppet-drupal-1b8b9da24e1337fcea57bcef67a45e35defba78b.tar.gz
puppet-drupal-1b8b9da24e1337fcea57bcef67a45e35defba78b.tar.bz2
Checking for existing installations on drupal script
Diffstat (limited to 'templates')
-rw-r--r--templates/drupal.sh.erb25
1 files changed, 21 insertions, 4 deletions
diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb
index e5956c8..34a6198 100644
--- a/templates/drupal.sh.erb
+++ b/templates/drupal.sh.erb
@@ -7,10 +7,18 @@ BASE="<%= apache_www_folder %>"
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
@@ -21,6 +29,7 @@ function drupal_deploy {
# 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
@@ -32,8 +41,14 @@ function drupal_deploy {
# 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`"
@@ -62,14 +77,16 @@ function drupal_upgrade {
# 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