From: Rodrigo Campos Date: Mon, 12 Jul 2010 16:26:11 +0000 (-0300) Subject: Support "--include-from" rsync option X-Git-Url: https://git.llucax.com/software/bacap.git/commitdiff_plain/f6851c8e5b1bbbb35527e7eb5526bc868c30414b Support "--include-from" rsync option Signed-off-by: Rodrigo Campos --- diff --git a/README b/README index c15200c..67b565f 100644 --- a/README +++ b/README @@ -120,6 +120,10 @@ backup rata's home:: echo /home/rata/ > $CONFIG_PATH/$LOCALHOST/excludes +Also, if you don't want to exclude files matching some pattern, you can create +a file named ``includes`` with the patterns you want to include (you can use +anything supported by the ``--include-from`` rsync_ option) + That's pretty much it. If you want to add other hosts, just create the host directory and the needed host configuration files. diff --git a/bacap b/bacap index dd83d2e..062902a 100755 --- a/bacap +++ b/bacap @@ -100,9 +100,11 @@ do [ "$host" != "$LOCALHOST" ] && src=`awk "{print \"$host:\"\\$1}" "$host_path/paths"` exclude="$host_path/excludes" + include="$host_path/includes" current_link="$host_backup_path/current" current_dir="$host_backup_path/`readlink \"$current_link\"`" exclude_flags= + include_flags= plog "-----------------------------------------------------------------" plog "Backup for host $host" plog "-----------------------------------------------------------------" @@ -117,12 +119,14 @@ do perror "$host is down, skipping..." && continue [ -r "$exclude" ] && - exclude_flags=" --exclude-from=$exclude --delete-excluded" + extra_flags="--exclude-from=$exclude --delete-excluded" + [ -r "$include" ] && + extra_flags="$extra_flags --include-from=$include" plog "Rotating backup..." $run cp -al $V "$current_dir" "$dst" || ret=$(($ret+1)) plog "Running rsync..." - $run rsync $RSYNC_FLAGS $exclude_flags $src "$dst/" || + $run rsync $RSYNC_FLAGS $extra_flags $src "$dst/" || ret=$(($ret+1)) plog "Moving current..." $run rm $V "$current_link" ||