diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2017-10-14 18:53:46 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2017-10-14 18:53:46 +0200 |
commit | 115aa33b40f69f7258748fba99ab57782da3794e (patch) | |
tree | d8531abfad68e10c7f1897241515d32c31334479 | |
parent | e38024893992966283e8397af1aa6dfc65241d73 (diff) | |
download | sync-115aa33b40f69f7258748fba99ab57782da3794e.tar.gz sync-115aa33b40f69f7258748fba99ab57782da3794e.tar.bz2 sync-115aa33b40f69f7258748fba99ab57782da3794e.zip |
Add support for rsync dry run
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rwxr-xr-x | sync | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -168,6 +168,8 @@ sync() { local descriptor local name local match + local dry + local dry_description set -e @@ -197,6 +199,12 @@ sync() { continue fi + if [ -n "$DRY" ] + then + dry="--dry-run" + dry_description=" \e[1;31m(dry run)\e[0m" + fi + source_path=$( host_file_path "$descriptor" ) destination_path=$( host_file_path "$match" ) @@ -204,9 +212,9 @@ sync() { host_excludes "$destination_name" "$name" >> "$DOTEXCLUDES" host_excludes "$source_name" "$name" >> "$DOTEXCLUDES" - echo -e "Sync \e[1;34m$name\e[0m from \e[1;33m$source\e[0m to \e[1;33m$destination\e[0m" + echo -e "Sync \e[1;34m$name\e[0m from \e[1;33m$source\e[0m to \e[1;33m$destination\e[0m$dry_description" - $RSYNC --exclude-from="$DOTEXCLUDES" "$source_prefix$source_path" "$destination_prefix$destination_path" + $RSYNC $dry --exclude-from="$DOTEXCLUDES" "$source_prefix$source_path" "$destination_prefix$destination_path" rm "$DOTEXCLUDES" done |