aboutsummaryrefslogtreecommitdiff
path: root/handlers/trac.in
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2007-10-12 17:06:09 +0000
committerintrigeri <intrigeri@boum.org>2007-10-12 17:06:09 +0000
commit579ea902ba24854b3c9acb307cda7e996e8e41a3 (patch)
tree373ce0a2242050dad65b84950520c6d44a9445fc /handlers/trac.in
parentbe75e4e6c536882c14db9a41c61585e7a9c045f6 (diff)
downloadbackupninja-579ea902ba24854b3c9acb307cda7e996e8e41a3.tar.gz
backupninja-579ea902ba24854b3c9acb307cda7e996e8e41a3.tar.bz2
fixed autotools build, broken since r466, inhandlers/Makefile.am
Diffstat (limited to 'handlers/trac.in')
-rw-r--r--handlers/trac.in58
1 files changed, 58 insertions, 0 deletions
diff --git a/handlers/trac.in b/handlers/trac.in
new file mode 100644
index 0000000..0460c9f
--- /dev/null
+++ b/handlers/trac.in
@@ -0,0 +1,58 @@
+# -*- 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
+
+error=0
+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"
+ error=1
+ fi
+done
+
+if [ $error -eq 1 ]; then
+ echo "Error: because of earlier errors, we are leaving trac backups in $tmp instead of $dest"
+else
+ if [ -d $dest -a -d $tmp ]; then
+ rm -rf $dest
+ fi
+ if [ -d $tmp ]; then
+ mv $tmp $dest
+ fi
+fi
+
+exit 0
+
+# vim: filetype=sh