disabled in backupninja.conf
. now works when multiple vservers names are given (separated by space)
in vsnames config variable
+ . make use of new lib/vserver functionality
ninjahelper changes
rdiff.helper:
. fixed errors in create remote dir
. init_vservers: canonicalize VROOTDIR (since duplicity et al.
don't follow symlinks)
. init_vservers: warn if vservers are enabled but no vserver is found
+ . new function: vservers_exist
known bugs:
easydialog:
. formDisplay does not return exit status.
[ "$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'
done
# vsincludes
-if [ $usevserver ]; then
+if [ $usevserver = yes ]; then
for vserver in $vsnames; do
for vi in "$vsinclude"; do
str="${vi//__star__/*}"
}
##
-## If the argument is the name of a vserver selected use by the current helper,
+## If all the arguments are existing vservers names, returns 0.
+## Else, returns 1. Also returns 1 if no argument is given.
+##
+vservers_exist() {
+ [ $# -ge 1 ] || return 1
+ local args="$1"
+ local vserver i found
+ for vserver in $args ; do
+ found=no
+ for i in $found_vservers ; do
+ if [ $vserver = $i ]; then
+ found=yes
+ break
+ fi
+ done
+ [ $found = yes ] || return 1
+ done
+ return 0
+}
+
+##
+## If the argument is the name of a vserver selected by the current helper,
## echoes 'on' and returns 0.
## Else, echoes 'off' and returns 1.
##