diff --git a/weave b/weave index 88fc10bd..8179f930 100755 --- a/weave +++ b/weave @@ -33,8 +33,18 @@ usage() { [ $# -gt 0 ] || usage -IMAGE=zettio/weave -DNS_IMAGE=zettio/weavedns +if [ "$SCRIPT_VERSION" = "(unreleased version)" ] ; then + IMAGE_VERSION=latest +else + IMAGE_VERSION=$SCRIPT_VERSION +fi + +IMAGE_VERSION=${VERSION:-$IMAGE_VERSION} + +BASE_IMAGE=zettio/weave +BASE_DNS_IMAGE=zettio/weavedns +IMAGE=$BASE_IMAGE:$IMAGE_VERSION +DNS_IMAGE=$BASE_DNS_IMAGE:$IMAGE_VERSION CONTAINER_NAME=weave DNS_CONTAINER_NAME=weavedns BRIDGE=weave @@ -358,9 +368,16 @@ check_not_running() { echo "$1 is already running." >&2 exit 1 ;; + "true $2:"*) + echo "$1 is already running." >&2 + exit 1 + ;; "false $2") docker rm $1 >/dev/null ;; + "false $2:"*) + docker rm $1 >/dev/null + ;; true*) echo "Found another running container named '$1'. Aborting." >&2 exit 1 @@ -429,7 +446,7 @@ DOCKER_VERSION_PATCH=$(echo "$DOCKER_VERSION" | cut -d. -f 3) case "$COMMAND" in launch) - check_not_running $CONTAINER_NAME $IMAGE + check_not_running $CONTAINER_NAME $BASE_IMAGE create_bridge # We set the router name to the bridge mac since that is # stable across re-creations of the containers. @@ -466,7 +483,7 @@ case "$COMMAND" in [ $# -gt 0 ] || usage CIDR=$1 shift 1 - check_not_running $DNS_CONTAINER_NAME $DNS_IMAGE + check_not_running $DNS_CONTAINER_NAME $BASE_DNS_IMAGE create_bridge docker_bridge_ip DNS_CONTAINER=$(docker run --privileged -d --name=$DNS_CONTAINER_NAME \