2005-12-28 21:19:29 +01:00
|
|
|
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
|
2009-05-22 15:27:09 +02:00
|
|
|
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
|
2005-06-13 21:37:26 +02:00
|
|
|
#
|
|
|
|
# this handler will backup trac environments (based on the svn handler)
|
|
|
|
#
|
|
|
|
# http://trac.edgewall.com/
|
|
|
|
#
|
|
|
|
|
|
|
|
getconf src /var/lib/trac
|
|
|
|
getconf dest /var/backups/trac
|
|
|
|
getconf tmp /var/backups/trac.tmp
|
|
|
|
|
|
|
|
cd $src
|
|
|
|
for repo in `find . -name VERSION`
|
|
|
|
do
|
2009-05-22 14:50:52 +02:00
|
|
|
repo=`dirname $repo`
|
|
|
|
if [ "$repo" == "." ]
|
|
|
|
then
|
|
|
|
repo=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Just make the parent directory for $tmp/$repo
|
|
|
|
parentdir=`dirname $tmp/$repo`
|
|
|
|
ret=`mkdir -p $parentdir 2>&1`
|
|
|
|
code=$?
|
|
|
|
if [ "$ret" ]; then
|
|
|
|
debug "$ret"
|
|
|
|
fi
|
|
|
|
if [ $code != 0 ]; then
|
|
|
|
error "command failed mkdir -p $parentdir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ret=`trac-admin $src/$repo hotcopy $tmp/$repo 2>&1`
|
|
|
|
code=$?
|
|
|
|
if [ "$ret" ]; then
|
|
|
|
debug "$ret"
|
|
|
|
fi
|
|
|
|
if [ $code != 0 ]; then
|
|
|
|
error "command failed -- trac-admin $src/$repo hotcopy $tmp/$repo"
|
|
|
|
fi
|
2005-06-13 21:37:26 +02:00
|
|
|
done
|
|
|
|
|
2008-06-25 05:27:06 +02:00
|
|
|
if [ -d $dest -a -d $tmp ]; then
|
2009-05-22 14:50:52 +02:00
|
|
|
rm -rf $dest
|
2008-06-25 05:27:06 +02:00
|
|
|
fi
|
|
|
|
if [ -d $tmp ]; then
|
2009-05-22 14:50:52 +02:00
|
|
|
mv $tmp $dest
|
2005-06-13 21:37:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
# vim: filetype=sh
|