Skip to content

Instantly share code, notes, and snippets.

@matglas
Created April 23, 2015 09:57
Show Gist options
  • Save matglas/c39a6995eb1365b253f7 to your computer and use it in GitHub Desktop.
Save matglas/c39a6995eb1365b253f7 to your computer and use it in GitHub Desktop.
Update a kw environment to latest version.
#!/bin/bash
# Usage: sh update.sh fase
# fase-1 or empty makes the pull
# fase-2 executes the script
#
# If you want to run a specific version checkout that
# version first in the src folder with git checkout [ref].
# Don't use a branch there because it still does a pull
# on the branch (if it is setup as a tracking branch).
# First, make the pull
if [ "$1" = "fase-1" -o "$1" = "" ]; then
# Fetch latest changes.
echo "# Fase-1"
echo "# Fetch latest changes"
cd `dirname $BASH_SOURCE`
cd src
git pull
echo ""
cd ../
sh update.sh fase-2
# then call this script again for execution
elif [ "$1" = "fase-2" ]; then
echo "# Fase-2"
# Go back to the project dir.
#clear cash drush
echo "#clear cache drush"
drush cache-clear drush
# Create a new build.
echo "# Backup de db and"
echo "# create a new build"
cd build
drush cc all
drush sql-dump --result-file
drush kw-b
echo ""
# Update the build.
echo "# Update the installation."
drush cc all
drush kw-u
drush cc all
drush cc drush
drush kw-u
# Return back to original directory.
cd ..
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment