Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2012-05-29 12:04:35 +02:00
parent d34ea9a9c9
commit 9d09407cc4
1 changed files with 4 additions and 1 deletions

View File

@ -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"