diff options
author | Micah Anderson <micah@riseup.net> | 2009-02-19 12:23:29 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2009-02-19 12:23:29 -0500 |
commit | 539fd1471907422d81626260ea4f1e23e4d398a4 (patch) | |
tree | efe32e02a285fe1d241e16c6701a95a8201d79e7 /handlers/trac.in | |
parent | 27a7859c42394a78c16b24f0d08ca28667bb1efa (diff) | |
download | backupninja-539fd1471907422d81626260ea4f1e23e4d398a4.tar.gz backupninja-539fd1471907422d81626260ea4f1e23e4d398a4.tar.bz2 |
move the branches directories up to the root of the repository
Diffstat (limited to 'handlers/trac.in')
-rw-r--r-- | handlers/trac.in | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/handlers/trac.in b/handlers/trac.in new file mode 100644 index 0000000..a4b7bdf --- /dev/null +++ b/handlers/trac.in @@ -0,0 +1,52 @@ +# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# +# 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 + + 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 +done + +if [ -d $dest -a -d $tmp ]; then + rm -rf $dest +fi +if [ -d $tmp ]; then + mv $tmp $dest +fi + +exit 0 + +# vim: filetype=sh |