Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2011-06-11 10:12:09 +0000
committershtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2011-06-11 10:12:09 +0000
commit79ffcba38904ec10a47d90c1756ee46f79e165e9 (patch)
tree8b3ccfc9b09a1fe89da4a1745cae71617bef0fa1 /openbsd
parent6a10b4fdfaa00fbafb6e69b01d1ff360758f3e7d (diff)
[OpenBSD scripts] More generic handling of backups excludes.
git-svn-id: svn+ssh://scm.narf.ssji.net/svn/shtrom/scripts@986 1991c358-8f32-0410-a49a-990740bdf4c2
Diffstat (limited to 'openbsd')
-rwxr-xr-xopenbsd/backup.sh19
1 files changed, 10 insertions, 9 deletions
diff --git a/openbsd/backup.sh b/openbsd/backup.sh
index 1e9f22e..4d33d66 100755
--- a/openbsd/backup.sh
+++ b/openbsd/backup.sh
@@ -5,7 +5,7 @@ BACKUPROOT="/srv/rdiff-backup"
BACKUPDIR="${BACKUPROOT}/`hostname -s`"
BACKUPSERVER=backup.narf.ssji.net
REMOTEBACKUPDIR="`hostname -s`@${BACKUPSERVER}::${BACKUPDIR}"
-EXCLUDEALWAYS="--exclude /srv/backup/ --exclude /srv/www/sites/offlines.fr/private/ --exclude /srv/www/sites/offlines.fr/www-svn/"
+EXCLUDEALWAYS="${BACKUPROOT} /srv/backup/ /srv/www/sites/offlines.fr/"
if [ "$1" = "remote" ]; then
EFFECTIVEBACKUPDIR=${REMOTEBACKUPDIR}
@@ -16,13 +16,14 @@ else
fi
echo -n "Backing up to ${EFFECTIVEBACKUPDIR}:"
-for DIR in $DIRS; do
- echo -n " $DIR"
- if [ "`dirname $BACKUPROOT`" = "$DIR" ]; then
- EXCL="${EXCLUDEALWAYS} --exclude $BACKUPROOT"
- else
- EXCL="${EXCLUDEALWAYS}"
- fi
- /usr/local/bin/rdiff-backup --create-full-path ${REMOTESCHEMA:+--remote-schema "${REMOTESCHEMA}"} $EXCL $DIR $EFFECTIVEBACKUPDIR$DIR
+for DIR in ${DIRS}; do
+ echo -n " ${DIR}"
+ EXCLS=""
+ for EXCL in ${EXCLUDEALWAYS}; do
+ if [ "${EXCL#${DIR}}" != "${EXCL}" ]; then
+ EXCLS="${EXCLS} --exclude ${EXCL}"
+ fi
+ done
+ /usr/local/bin/rdiff-backup --create-full-path ${REMOTESCHEMA:+--remote-schema "${REMOTESCHEMA}"} ${EXCLS} ${DIR} ${EFFECTIVEBACKUPDIR}${DIR}
done
echo "."