#!/bin/bash ## ## Updates Wordpress in this directory to maximum release version. ## LCYAN="\033[1;35m" NOCOL="\033[0m" update() { svninfo=`svn info 2>/dev/null` # check that directory is a working copy if [ "$?" -ne 0 ]; then echo -e "$LCYAN$(readlink -f .)$NOCOL is not a working copy." return fi oldurl=`echo "$svninfo" | grep '^URL:'` oldurl=${oldurl##* } oldversion=${oldurl##*/} tagurl=${oldurl%/*} newversion=`svn ls "$tagurl" | sed -e 's/\/$//' | sort --version-sort | tail -n 1` if [ "$oldversion" == "$newversion" ]; then echo "$(readlink -f .) is up to date with version $newversion." else echo -e "Update $LCYAN`readlink -f .`$NOCOL from version '$LCYAN$oldversion$NOCOL' to '$LCYAN$newversion$NOCOL'?" select prompt in "Yes" "No but continue" "Abort"; do case $prompt in Yes ) break;; "No but continue" ) return;; Abort ) exit;; esac done echo --- svn switch "$tagurl/$newversion" echo --- fi } if [ "$#" -ne 0 ]; then echo "Usage: $0" exit fi # main update # plugins pushd wp-content/plugins/ >/dev/null for plugindir in *; do if [ -d "$plugindir" ]; then pushd "$plugindir" >/dev/null update popd >/dev/null fi done popd >/dev/null