X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstatic-master-ssh-wrap;h=06ab715f4d95460222b43da34d858f997878b34c;hb=f42cb0499ff05950c567b58393e81ffe77292b49;hp=df7e7217bc6e876891d3731d7105f89da2a060fa;hpb=9cbba66bc8ff183ca0d138533698b63792e2a578;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/files/static-mirroring/static-master-ssh-wrap b/modules/roles/files/static-mirroring/static-master-ssh-wrap index df7e7217b..06ab715f4 100755 --- a/modules/roles/files/static-mirroring/static-master-ssh-wrap +++ b/modules/roles/files/static-mirroring/static-master-ssh-wrap @@ -70,32 +70,19 @@ lock() { fi } -serve_dir() { - local remote_host="$1"; shift - local path="$1"; shift - - local sender='rsync --server --sender -vlogDtprze.iLsf . ' - - if [ -e "$path" ]; then - info "serving $remote_host with $path" - $sender "$path/" - else - info "$remote_host wants non-existing $path" - echo >&2 "$path does not exist." - exit 1 - fi -} - do_rsync() { local remote_host="$1"; shift - if [ "$*" = "--server --sender -vlogDtprze.iLsf . -new-/" ] ; then - serve_dir "$remote_host" "$BASEDIR/current-push" - elif [ "$*" = "--server --sender -vlogDtprze.iLsf . -live-/" ] ; then - local p="$BASEDIR/current-live" - info "host $remote_host wants $p, acquiring lock" - lock 200 "$p" 0 - serve_dir "$remote_host" "$p" + local args="--server --sender -vltrze.iLsf --safe-links ." + if [ "$*" = "$args -new-/" ] ; then + local path="$BASEDIR/current-push" + info "serving $remote_host with $path" + rsync $args "$path/." + elif [ "$*" = "$args . -live-/" ] ; then + local path="$BASEDIR/current-live" + info "host $remote_host wants $path, acquiring lock" + lock 200 "$path" 0 + rsync $args "$path/." else info "NOT allowed for $remote_host: rsync $*" echo >&2 "This rsync command ($@) not allowed."