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"