|
|
@ -1,6 +1,7 @@ |
|
|
|
#!/bin/sh |
|
|
|
#!/bin/sh |
|
|
|
# |
|
|
|
# |
|
|
|
# 2012 Matt Coddington (mcoddington at gmail.com) |
|
|
|
# 2012 Matt Coddington (mcoddington at gmail.com) |
|
|
|
|
|
|
|
# 2012 Steven Armstrong (steven-cdist at armstrong.cc) |
|
|
|
# |
|
|
|
# |
|
|
|
# This file is part of cdist. |
|
|
|
# This file is part of cdist. |
|
|
|
# |
|
|
|
# |
|
|
@ -27,6 +28,9 @@ |
|
|
|
# cdist config --remote-copy /path/to/this/script target_host |
|
|
|
# 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 |
|
|
|
# second last argument is the source |
|
|
|
source_index=$(($#-1)) |
|
|
|
source_index=$(($#-1)) |
|
|
|
index=0 |
|
|
|
index=0 |
|
|
@ -37,7 +41,6 @@ for arg in $@; do |
|
|
|
fi |
|
|
|
fi |
|
|
|
index=$((index+=1)) |
|
|
|
index=$((index+=1)) |
|
|
|
if [ $index -eq $source_index -a -d "$arg" ]; then |
|
|
|
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%/}/" |
|
|
|
arg="${arg%/}/" |
|
|
|
fi |
|
|
|
fi |
|
|
|
set -- "$@" "$arg" |
|
|
|
set -- "$@" "$arg" |
|
|
|