#!/bin/bash # Purpose: Update all source code checkouts on a local machine # Handles CVS and SVN if [ -e /etc/init.d/functions.sh ]; then source /etc/init.d/functions.sh else ebegin() { echo "${1}..." } einfo() { echo "${1}" } fi get_time() { local update_cmd=${1} randtmp=$(mktemp) /usr/bin/time -o ${randtmp} -p ${update_cmd} > /dev/null 2>&1 einfo " Time: $(grep real ${randtmp} | cut -f2 -d' ') seconds" rm ${randtmp} } REPO_MAINDIR="/usr/local/share" pushd ${REPO_MAINDIR} > /dev/null 2>&1 einfo "Updating Subversion checkouts" for SVNDIR in */.svn */*/.svn */*/*/.svn; do if [ -e ${SVNDIR}/../../.svn ]; then continue fi pushd ${SVNDIR%\/*} > /dev/null 2>&1 ebegin " Updating ${SVNDIR%\/*}" get_time "svn up" eend $? popd > /dev/null 2>&1 done einfo "Updating CVS checkouts" for CVSDIR in */CVS */*/CVS */*/CVS; do if [ -e ${CVSDIR}/../../CVS ]; then continue fi pushd ${CVSDIR%\/*} > /dev/null 2>&1 ebegin " Updating ${CVSDIR%\/*}" get_time "cvs up" eend $? popd > /dev/null 2>&1 done popd > /dev/null 2>&1