blob: 018bffd8c3b6f7087500a055dfe070045586514a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
#
# 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
|