Browse Source

drone: improved rsync script

pull/13/head
Sebastian Heimann 11 months ago
parent
commit
8dc5e6fa73
  1. 15
      maintenance/drone/rsync.sh

15
maintenance/drone/rsync.sh

@ -6,17 +6,18 @@ set -e
[ ! -z "$DRONE" ] || exit 1
keypath=/tmp/rsync-key-$$
keypath="/tmp/rsync-key-$$"
umask 0077
echo "$RSYNC_KEY" > $keypath
echo "$RSYNC_KEY" > "$keypath"
umask 0022
temppath=/tmp/rsync-temp-$$
temppath="/tmp/rsync-temp-$$"
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/$target"
rsync -rv -e "ssh -o StrictHostKeyChecking=no -i $keypath" "$temppath/" "${RSYNC_USER}@${RSYNC_HOST}:"
rm $keypath
rm "$keypath"
Loading…
Cancel
Save