aboutsummaryrefslogtreecommitdiff
path: root/handlers/dup
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2006-01-19 21:56:53 +0000
committerintrigeri <intrigeri@boum.org>2006-01-19 21:56:53 +0000
commit299a53073483adce34c3d6a3c931f506af83b18e (patch)
treeae6f078107dd699ecdd481e0d1c3d0a46c7a208f /handlers/dup
parent96023985bce5fc3186487a08efe1e3b665574ced (diff)
downloadbackupninja-299a53073483adce34c3d6a3c931f506af83b18e.tar.gz
backupninja-299a53073483adce34c3d6a3c931f506af83b18e.tar.bz2
lib/vserver.in: new function: vservers_exist
handlers/dup: make use of new lib/vserver functionality
Diffstat (limited to 'handlers/dup')
-rw-r--r--handlers/dup39
1 files changed, 15 insertions, 24 deletions
diff --git a/handlers/dup b/handlers/dup
index ac7e329..d32fcf2 100644
--- a/handlers/dup
+++ b/handlers/dup
@@ -34,29 +34,20 @@ destdir=${destdir%/}
[ "$include" != "" ] || fatal "No source includes specified"
### vservers stuff ###
-
-# See if vservers are configured.
-# If so, check that the ones listed in $vsnames do exist.
-if [ "$vservers" == "yes" ]; then
- [ -d "$VROOTDIR" ] || fatal "vservers enabled, but $VROOTDIR does not exist!"
- if [ "$vsnames" == "all" ]; then
- vsnames=""
- for vserver in `ls $VROOTDIR | grep -E -v "lost+found|ARCHIVES"`; do
- vsnames="$vserver $vsnames"
- done
- else
- for vserver in $vsnames; do
- [ -d "$VROOTDIR/$vserver" ] || fatal "vserver '$vserver' does not exist."
- done
- fi
- if [ -n "$vsnames" ]; then
- if [ -n "$vsinclude" ]; then
- info "Using vservers '$vsnames'"
- usevserver=1
- fi
- else
- [ -z "$vsinclude" ] || warning 'vsnames is empty, vsinclude configuration lines will be ignored'
- fi
+local usevserver=no
+# If vservers are configured, check that the ones listed in $vsnames do exist.
+if [ $vservers_are_available = yes ]; then
+ if [ "$vsnames" = all ]; then
+ vsnames="$found_vservers"
+ else
+ if ! vservers_exist "$vsnames" ; then
+ fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
+ fi
+ fi
+ if [ -n "$vsinclude" ]; then
+ info "Using vservers '$vsnames'"
+ usevserver=yes
+ fi
else
[ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
[ -z "$vsnames" ] || warning 'vservers support disabled in backupninja.conf, vsnames configuration line will be ignored'
@@ -135,7 +126,7 @@ for i in "$include"; do
done
# vsincludes
-if [ $usevserver ]; then
+if [ $usevserver = yes ]; then
for vserver in $vsnames; do
for vi in "$vsinclude"; do
str="${vi//__star__/*}"