]> gitweb.fluxo.info Git - backupninja.git/commitdiff
rsync: generate excludes command-line snippet the same way as the duplicity handler...
authorintrigeri <intrigeri@boum.org>
Fri, 15 Jun 2012 18:21:09 +0000 (20:21 +0200)
committerintrigeri <intrigeri@boum.org>
Fri, 15 Jun 2012 18:21:09 +0000 (20:21 +0200)
The latter has a robust history wrt. dealing with excludes / glob / quoting
etc., let's use that instead of the shiny new sed-based way.

handlers/rsync.in

index 386255ea865b990fc8e0919b7ed160e37e0533ba..c584e7f098b8e6112619a5ca52cc1a4ba551ee80 100644 (file)
@@ -275,8 +275,15 @@ function eval_config {
     mv=move_files
   fi
 
-  excludes=`echo "$exclude" | @SED@ -e "s/^/--exclude='/g" -e "s/ /' --exclude='/g" -e "s/$/'/"`
-
+  set -o noglob
+  SAVEIFS=$IFS
+  IFS=$(echo -en "\n\b")
+  for i in $exclude; do
+     str="${i//__star__/*}"
+     excludes="${excludes} --exclude='$str'"
+  done
+  IFS=$SAVEIFS
+  set +o noglob
 }
 
 function rotate_short {