mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-26 04:32:42 +01:00
78884142e7
The modelines added match the emacs lines already present and also set the filetype to sh (just like the emacs lines).
53 lines
1.0 KiB
Bash
53 lines
1.0 KiB
Bash
# -*- 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
|