]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/roles/files/static-mirroring/static-mirror-run
several fixes
[dsa-puppet.git] / modules / roles / files / static-mirroring / static-mirror-run
index 72f7aea610e7f500a05c87fa488abf9024c4001f..0f7bc14c9e724e828c91ba3d224d387fc014715d 100755 (executable)
@@ -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"