ferm: drop FREEBSD_SSH_ACCESS
[mirror/dsa-puppet.git] / modules / roles / files / static-mirroring / staticsync-ssh-wrap
index a407547..959b4f8 100755 (executable)
@@ -97,9 +97,13 @@ do_rsync_on_master() {
                        elif [ "$*" = "$args $component/-live-/" ] || [ "$*" = "$args ./$component/-live-/" ] ; then
                                local path="$BASEDIR/master/$component-current-live"
                                info "host $remote_host wants $path, acquiring lock"
-                               exec 200< "$path"
+                               tgtlock="$BASEDIR/master/$component.lock"
+                               if ! [ -e "$tgtlock" ]; then
+                                       touch "$tgtlock"
+                               fi
+                               exec 200< "$tgtlock"
                                if ! flock -s -w 0 200; then
-                               echo >&2 "Cannot acquire shared lock on $path - this should mean an update is already underway anyway."
+                               echo >&2 "Cannot acquire shared lock on $tgtlock covering $path - this should mean an update is already underway anyway."
                                exit 1
                                fi
                                exec rsync $args "$path/."