From 9d09407cc476993cc94380469b97fd350a8ec332 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 12:04:35 +0200 Subject: [PATCH] ++doc Signed-off-by: Steven Armstrong --- other/examples/remote/rsync/copy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/other/examples/remote/rsync/copy b/other/examples/remote/rsync/copy index 0d4bd165..76217caf 100755 --- a/other/examples/remote/rsync/copy +++ b/other/examples/remote/rsync/copy @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Matt Coddington (mcoddington at gmail.com) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -27,6 +28,9 @@ # cdist config --remote-copy /path/to/this/script target_host # +# For rsync to do the right thing, the source has to end with "/" if it is +# a directory. The below preprocessor loop takes care of that. + # second last argument is the source source_index=$(($#-1)) index=0 @@ -37,7 +41,6 @@ for arg in $@; do fi index=$((index+=1)) if [ $index -eq $source_index -a -d "$arg" ]; then - # if the source is a directory, it has to end with "/" for rsync to do the right thing arg="${arg%/}/" fi set -- "$@" "$arg"