do_rsync() {
local remote_host="$1"; shift
- local args="--server --sender -vltrze.iLsf --safe-links ."
- if [ "$*" = "$args -new-/" ] ; then
+ local args="--server --sender -vlHtrze.iLsf --safe-links ."
+ if [ "$*" = "$args -new-/" ] || [ "$*" = "$args ./-new-/" ] ; then
local path="$BASEDIR/current-push"
info "serving $remote_host with $path"
- rsync $args "$path"
- elif [ "$*" = "$args . -live-/" ] ; then
+ rsync $args "$path/."
+ elif [ "$*" = "$args . -live-/" ] || [ "$*" = "$args . ./-live-/" ] ; then
local path="$BASEDIR/current-live"
info "host $remote_host wants $path, acquiring lock"
lock 200 "$path" 0
- rsync $args "$path"
+ rsync $args "$path/."
else
info "NOT allowed for $remote_host: rsync $*"
echo >&2 "This rsync command ($@) not allowed."
component="$1"
shift
- hit="$(awk -v component="$component" -v host="$remote_host" '$1 == component && $2 == host {print $3; exit}' "$COMPONENTLIST")"
+ hit="$(
+ awk -v component="$component" -v host="$remote_host" '
+ $1 == component {
+ if ($2 == host) {
+ print $3
+ exit
+ }
+ split($4,extra,",")
+ for (i in extra) {
+ if (host == extra[i]) {
+ printf "%s:%s\n", $2, $3
+ exit
+ }
+ }
+ exit
+ }' "$COMPONENTLIST"
+ )"
if [ -n "$hit" ]; then
exec static-master-update-component "$component"
echo >&2 "Exec failed"