All pastes #1494917 Raw Edit

Batch upgrade script for multipl

public text v1 · immutable
#1494917 ·published 2009-07-14 17:42 UTC
rendered paste body
#!/bin/bash

# Change the following variable to your own path.
# Assumes all wp installs within the following directory are
# svn checkouts from http://svn.automattic.com/wordpress
BASE_PATH="/path/to/the/directory/containing/all/your/wp/installs"

# Automattic SVN repos (uncomment the one you want, wp or wpmu)
WP_SVN="http://svn.automattic.com/wordpress/tags"
# WP_SVN="http://svn.automattic.com/wordpress-mu/tags"

### Leave the rest as is ###

BLOG=$1

TAG=$2

# Give usage help if no arg was sent
if [ "$BLOG" == "" -o "$TAG" == "" ]; then
  echo "Usage: $0 all|directory_name tag"
  echo "Where:"
  echo "- directory_name is a valid directory in $BASE_PATH"
  echo "- tag is the new tag as found in $WP_SVN"
  exit 1
fi

# Give error if sent arg is not valid
if [ "$BLOG" != "all" ]; then
  if [ ! -d "$BASE_PATH/$BLOG" ]; then
    echo "Sorry, but $BASE_PATH/$BLOG is not a valid directory"
    exit 1
  fi
fi

cd $BASE_PATH

# svn up all or single instance
if [ $BLOG == "all" ]; then
  for i in $(ls); do
    echo $i
    cd $i
    svn sw "$WP_SVN/$TAG"
    cd $BASE_PATH;
  done
else
  cd "$BASE_PATH/$BLOG"
  svn sw "$WP_SVN/$TAG"
  cd $BASE_PATH;
fi

exit