X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstatic-mirror-run;h=0f7bc14c9e724e828c91ba3d224d387fc014715d;hb=df8f24895ce2f6f71c54701f90faf530a4405213;hp=72f7aea610e7f500a05c87fa488abf9024c4001f;hpb=49428e397bab9eb9ccc420a3195cdb69b5bee86b;p=dsa-puppet.git diff --git a/modules/roles/files/static-mirroring/static-mirror-run b/modules/roles/files/static-mirroring/static-mirror-run index 72f7aea6..0f7bc14c 100755 --- a/modules/roles/files/static-mirroring/static-mirror-run +++ b/modules/roles/files/static-mirroring/static-mirror-run @@ -106,6 +106,7 @@ log() { } lock() { + mkdir -p "$BASEDIR" exec 200< "$BASEDIR" if ! flock -e 200; then log "Cannot acquire lock." @@ -125,12 +126,12 @@ lock if [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$ALPHA" ] ; then staging="$BRAVO" active="$ALPHA" -elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$BRAVO" ] ; then - staging="$ALPHA" - active="$BRAVO" -else +elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" != "$BRAVO" ] ; then echo >&5 "Invalid state of ${BASEDIR}${ACTIVE}." exit 1 +else + staging="$ALPHA" + active="$BRAVO" fi log "active is $active; staging is $staging"