|
|
@ -6,17 +6,18 @@ set -e |
|
|
|
[ ! -z "$DRONE" ] || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
keypath=/tmp/rsync-key-$$ |
|
|
|
keypath="/tmp/rsync-key-</span><span class="nv">$$" |
|
|
|
|
|
|
|
umask 0077 |
|
|
|
echo "$RSYNC_KEY" > $keypath |
|
|
|
echo "$RSYNC_KEY" > "$keypath" |
|
|
|
umask 0022 |
|
|
|
|
|
|
|
temppath=/tmp/rsync-temp-$$ |
|
|
|
temppath="/tmp/rsync-temp-</span><span class="nv">$$" |
|
|
|
|
|
|
|
mkdir -p $temppath/$2 |
|
|
|
target="${@: -1}" |
|
|
|
mkdir -p "$temppath/$target" |
|
|
|
|
|
|
|
rsync -av $1 $temppath/$2 |
|
|
|
rsync -rv -e "ssh -o StrictHostKeyChecking=no -i $keypath" $temppath/ ${RSYNC_USER}@${RSYNC_HOST}: |
|
|
|
rsync -av "${@:1:$#-1}" "$temppath/</span><span class="nv">$target" |
|
|
|
rsync -rv -e "ssh -o StrictHostKeyChecking=no -i $keypath" "$temppath/" "${RSYNC_USER}@${RSYNC_HOST}:" |
|
|
|
|
|
|
|
rm $keypath |
|
|
|
rm "$keypath" |