projects
/
matthijs
/
upstream
/
backupninja-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
really fix the insecure temp file creation
[matthijs/upstream/backupninja-vserver.git]
/
handlers
/
rdiff
diff --git
a/handlers/rdiff
b/handlers/rdiff
index 61eb7f5c7e05d5af6cfa82ae3303909269779f46..40ad52dd585dbbcc836872db4a11c2275fc3e3f5 100644
(file)
--- a/
handlers/rdiff
+++ b/
handlers/rdiff
@@
-12,6
+12,7
@@
getconf type; sourcetype=$type
getconf label
getconf keep 60
getconf include
getconf label
getconf keep 60
getconf include
+getconf vsinclude
getconf exclude
### DESTINATION ###
getconf exclude
### DESTINATION ###
@@
-24,14
+25,26
@@
getconf type; desttype=$type
getconf user; destuser=$user
getconf host; desthost=$host
getconf user; destuser=$user
getconf host; desthost=$host
+# See if vservers are configured
+if [ "$vservers" = "yes" ]
+then
+ if [ ! -d $VROOTDIR ]
+ then
+ fatal "vservers enabled, but $VROOTDIR does not exist!"
+ else
+ info "vserver method enabled"
+ usevserver=1
+ fi
+fi
+
[ "$destdir" != "" ] || fatal "Destination directory not set"
if [ "$desttype" == "remote" ]; then
# see if we can login
if [ "$testconnect" == "yes" ]; then
hostalive=0
[ "$destdir" != "" ] || fatal "Destination directory not set"
if [ "$desttype" == "remote" ]; then
# see if we can login
if [ "$testconnect" == "yes" ]; then
hostalive=0
- debug "ssh -o P
asswordAuthentication=no
$desthost -l $destuser 'echo -n 1'"
- ret=`ssh -o P
asswordAuthentication=no
$desthost -l $destuser 'echo -n host is alive'`
+ debug "ssh -o P
referredAuthentications=publickey
$desthost -l $destuser 'echo -n 1'"
+ ret=`ssh -o P
referredAuthentications=publickey
$desthost -l $destuser 'echo -n host is alive'`
if echo $ret | grep "host is alive"; then
debug "Connected to $desthost as $destuser successfully"
else
if echo $ret | grep "host is alive"; then
debug "Connected to $desthost as $destuser successfully"
else
@@
-39,8
+52,8
@@
if [ "$desttype" == "remote" ]; then
fi
fi
# see that rdiff-backup has the same version as here
fi
fi
# see that rdiff-backup has the same version as here
- debug "ssh $desthost -l $destuser '$RDIFFBACKUP -V'\""
- remoteversion=`ssh $desthost -l $destuser "$RDIFFBACKUP -V | grep rdiff-backup"`
+ debug "ssh
-o PreferredAuthentications=publickey
$desthost -l $destuser '$RDIFFBACKUP -V'\""
+ remoteversion=`ssh
-o PreferredAuthentications=publickey
$desthost -l $destuser "$RDIFFBACKUP -V | grep rdiff-backup"`
localversion=`$RDIFFBACKUP -V`
if [ "$remoteversion" != "$localversion" ]; then
fatal "rdiff-backup does not have the same version on this computer and the backup server."
localversion=`$RDIFFBACKUP -V`
if [ "$remoteversion" != "$localversion" ]; then
fatal "rdiff-backup does not have the same version on this computer and the backup server."
@@
-52,9
+65,9
@@
fi
### SOURCE ###
### SOURCE ###
-[ "$label" != "" ] || fatal "Source missing label"
[ "$sourcetype" == "local" ] || fatal "Only local source type supported"
[ "$sourcetype" == "local" ] || fatal "Only local source type supported"
-[ "$include" != "" ] || fatal "No source includes specified"
+[ "$include" != "" -o "$vsinclude" != "" ] || fatal "No source includes specified"
+#TODO should I test for vsinclude if usevservers=1?
execstr_clientpart="/"
execstr_clientpart="/"
@@
-101,6
+114,19
@@
for i in $include; do
execstr="${execstr}--include '$str' "
done
execstr="${execstr}--include '$str' "
done
+# vsinclude
+if [ $usevserver ]
+then
+ for vserver in `ls $VROOTDIR | grep -E -v "lost+found|ARCHIVES"`
+ do
+ for vi in $vsinclude
+ do
+ str="${vi//__star__/*}"
+ execstr="${execstr}--include '$VROOTDIR/$vserver$str' "
+ done
+ done
+fi
+
# exclude everything else
execstr="${execstr}--exclude '/*' "
# exclude everything else
execstr="${execstr}--exclude '/*' "
@@
-113,10
+139,10
@@
if [ ! $test ]; then
code=$?
if [ "$code" == "0" ]; then
debug $output
code=$?
if [ "$code" == "0" ]; then
debug $output
- info "Successfully finished backing up source
'$label'
"
+ info "Successfully finished backing up source
$label
"
else
warning $output
else
warning $output
- warning "Failed backup up source
'$label'
"
+ warning "Failed backup up source
$label
"
fi
fi
fi
fi