diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-03-09 16:47:39 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-03-09 16:47:39 -0300 |
commit | 3e1f6d3f414b809ba4ed1631d49dbb428f79ee7b (patch) | |
tree | 7f802faa341248e02cd4e6ec7951c23be659584d /templates | |
parent | e86d178f388fce27337fc434a4abd2245634e963 (diff) | |
download | puppet-drupal-3e1f6d3f414b809ba4ed1631d49dbb428f79ee7b.tar.gz puppet-drupal-3e1f6d3f414b809ba4ed1631d49dbb428f79ee7b.tar.bz2 |
Adding cron handling into drupal script
Diffstat (limited to 'templates')
-rw-r--r-- | templates/drupal.sh.erb | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb index 26060fd..3a10864 100644 --- a/templates/drupal.sh.erb +++ b/templates/drupal.sh.erb @@ -14,36 +14,13 @@ function drupal_get_major { # Check for existing installations function drupal_check_existing { if [ -e "$BASE/drupal-$1" ]; then - echo "Folder $BASE/drupal-$1 already exist, skipping" + echo "Folder $BASE/drupal-$1 already exists, skipping" exit 1 fi } -# Deploy a fresh drupal tree -function drupal_deploy { - if [ "$#" != "1" ]; then - echo "Usage: `basename $0` deploy <version>" - exit 1 - fi - - # 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 - tar zxvf drupal-$new.tar.gz && rm drupal-$new.tar.gz - chown -R root.root drupal-$new/ - cd drupal-$new && rm -rf sites -} - -# Update all drupal instances in the host -function drupal_update { - if [ -z "$update" ]; then - update="update" - fi - +# Iterate through all drupal instances +function drupal_iterate { for version in $SERIES; do # Setup base folder base="$BASE/drupal-$version" @@ -61,7 +38,7 @@ function drupal_update { # Ignore symlinks so sites are updated just once if [ ! -h "$drupal" ] || [ ! -h "`readlink $drupal`" ]; then echo "Processing $drupal..." - drush -l $drupal $update + drush -l $drupal $* fi done @@ -75,6 +52,25 @@ function drupal_update { done } +# Deploy a fresh drupal tree +function drupal_deploy { + if [ "$#" != "1" ]; then + echo "Usage: `basename $0` deploy <version>" + exit 1 + fi + + # 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 + tar zxvf drupal-$new.tar.gz && rm drupal-$new.tar.gz + chown -R root.root drupal-$new/ + cd drupal-$new && rm -rf sites +} + # Upgrade a drupal instance using upstream source. function drupal_upgrade { if [ "$#" != "2" ]; then @@ -150,18 +146,19 @@ function drupal_upgrade { # Main procedure if [ -z "$1" ]; then - echo "Usage: `basename $0` <deploy|update|upgrade> [arguments]" + echo "Usage: `basename $0` <cron|deploy|update|updatedb|upgrade> [arguments]" exit 1 +elif [ "$1" == "cron" ]; then + drupal_iterate cron elif [ "$1" == "deploy" ]; then shift drupal_deploy $* elif [ "$1" == "update" ]; then shift - drupal_update $* + drupal_iterate update $* elif [ "$1" == "updatedb" ]; then shift - update="updatedb" - drupal_update $* + drupal_iterate updatedb $* elif [ "$1" == "upgrade" ]; then shift drupal_upgrade $* |