From 814056989dc2edcb5f8e964cf787dbb8ad0988db Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 15 Nov 2012 11:34:27 -0200 Subject: Introducing drupal_update function --- templates/drupal.sh.erb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb index 84843b8..06754c8 100644 --- a/templates/drupal.sh.erb +++ b/templates/drupal.sh.erb @@ -82,7 +82,12 @@ function drupal_iterate { if [ "$1" != "cron" ] && [ "$SILENT" != "yes" ]; then echo "Processing $drupal..." fi - drush -l $drupal $* + + if [ "$1" == "update" && "$1" == "cron-update" ]; then + drupal_update $1 $drupal + else + drush -l $drupal $* + fi fi fi done @@ -97,6 +102,22 @@ function drupal_iterate { done } +# Update a drupal instance +function drupal_update { + local method="$1" + local instance="$2" + local pipe + + if [ "$method" == "" ]; then + pipe="--pipe" + fi + + # See https://drupal.org/node/823146#comment-3319070 + # Also, avoid automated core updates + drush -l $instance up -u 1 --pipe | grep -v -E '^drupal|Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK' \ + | cut -d " " -f1 | xargs drush up -u 1 -y $pipe +} + # Deploy a fresh drupal tree function drupal_deploy { if [ -z "$1" ]; then @@ -375,7 +396,7 @@ elif [ "$1" == "cron" ]; then elif [ "$1" == "cron-update" ]; then SILENT="yes" drupal_iterate pm-refresh &> /dev/null - drupal_iterate pm-update -y -p | grep -v -E 'Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK' + drupal_iterate pm-update elif [ "$1" == "deploy" ]; then shift drupal_deploy $* -- cgit v1.2.3