X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstatic-mirror-run;h=0f7bc14c9e724e828c91ba3d224d387fc014715d;hb=df8f24895ce2f6f71c54701f90faf530a4405213;hp=038700ddb73a4497e61b7ab834a9011823f8783f;hpb=83c98bce49fad95a56e4d52e6dd9d2558439f55a;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/files/static-mirroring/static-mirror-run b/modules/roles/files/static-mirroring/static-mirror-run index 038700ddb..0f7bc14c9 100755 --- a/modules/roles/files/static-mirroring/static-mirror-run +++ b/modules/roles/files/static-mirroring/static-mirror-run @@ -1,6 +1,6 @@ #!/bin/bash -# initiate a mirror staged mirror update from sync-source. +# initiate a staged mirror update from sync-source for a component. # # if we have a serial file and we got a serial on the command line, only sync if the serial is different @@ -106,6 +106,7 @@ log() { } lock() { + mkdir -p "$BASEDIR" exec 200< "$BASEDIR" if ! flock -e 200; then log "Cannot acquire lock." @@ -119,13 +120,15 @@ lock() { log_setup -#log "called with $* and ${SSH_ORIGINAL_COMMAND:-no ssh original command options}." log "called with $*" lock if [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$ALPHA" ] ; then staging="$BRAVO" active="$ALPHA" +elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" != "$BRAVO" ] ; then + echo >&5 "Invalid state of ${BASEDIR}${ACTIVE}." + exit 1 else staging="$ALPHA" active="$BRAVO"