mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-08 11:52:32 +01:00
4ecaae9405
Previously, there were many indentation styles in use: Real tabs, 2, 3 or 4 spaces, mixing these within the same file, function or even within a single line. This commit changes all bash scripts in the handlers, src and lib dirs to use consistent indentation: three spaces are now used everywhere. Other files (e.g. Makefiles) are left untouched. Additionally, this commit removes all trailing whitespace.
52 lines
994 B
Bash
52 lines
994 B
Bash
# -*- 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
|