Put versions in the script and weavedns too, and report them

sudo weave version
This commit is contained in:
Michael Bridgen committed 2014-12-24 11:04:52 +00:00
1 parent 0348767d73
commit b014d98c78
3 files changed
+31 -9

No files matched your search

+2
View File
@@ -47,6 +47,8 @@ build() {
## (library versions?) ## (library versions?)
sed -i "/var version = / c\var version = \"$VERSION\"" weaver/main.go sed -i "/var version = / c\var version = \"$VERSION\"" weaver/main.go
sed -i "/var version = / c\var version = \"$VERSION\"" weavedns/main.go
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
make \ make \
WEAVER_IMAGE=$DOCKERHUB_USER/weave \ WEAVER_IMAGE=$DOCKERHUB_USER/weave \
WEAVEDNS_IMAGE=$DOCKERHUB_USER/weavedns WEAVEDNS_IMAGE=$DOCKERHUB_USER/weavedns
+11 -2
View File
@@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
set -e set -e
SCRIPT_VERSION="(unreleased version)"
usage() { usage() {
echo "Usage:" echo "Usage:"
echo "weave launch [-password <password> | -passwordfile <path>] <peer> ..." echo "weave launch [-password <password> | -passwordfile <path>] <peer> ..."
@@ -479,14 +481,21 @@ case "$COMMAND" in
;; ;;
version) version)
[ $# -eq 0 ] || usage [ $# -eq 0 ] || usage
# Try the running container first; if no luck try the image echo weave script $SCRIPT_VERSION
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Image }}' $CONTAINER_NAME 2>/dev/null) ; then if ! DOCKERIMAGE=$(docker inspect --format='{{ .Image }}' $CONTAINER_NAME 2>/dev/null) ; then
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Id }}' $IMAGE 2>/dev/null) ; then if ! DOCKERIMAGE=$(docker inspect --format='{{ .Id }}' $IMAGE 2>/dev/null) ; then
echo "Unable to find $IMAGE image." >&2 echo "Unable to find $IMAGE image." >&2
exit 1 exit 1
fi fi
fi fi
docker images --no-trunc | grep $DOCKERIMAGE | grep -v latest | tr -s ' ' | cut -d ' ' -f 2 docker run --rm $DOCKERIMAGE --version
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Image }}' $DNS_CONTAINER_NAME 2>/dev/null) ; then
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Id }}' $DNS_IMAGE 2>/dev/null) ; then
echo "Unable to find $DNS_IMAGE image." >&2
exit 1
fi
fi
docker run --rm $DOCKERIMAGE --version
;; ;;
run) run)
[ $# -gt 0 ] || usage [ $# -gt 0 ] || usage
+18 -7
View File
@@ -2,24 +2,30 @@ package main
import ( import (
"flag" "flag"
"fmt"
weavedns "github.com/zettio/weave/nameserver" weavedns "github.com/zettio/weave/nameserver"
weavenet "github.com/zettio/weave/net" weavenet "github.com/zettio/weave/net"
"io"
"io/ioutil" "io/ioutil"
"net" "net"
"os" "os"
) )
var version = "(unreleased version)"
func main() { func main() {
var ( var (
ifaceName string justVersion bool
apiPath string ifaceName string
dnsPort int apiPath string
httpPort int dnsPort int
wait int httpPort int
watch bool wait int
debug bool watch bool
debug bool
) )
flag.BoolVar(&justVersion, "version", false, "print version and exit")
flag.StringVar(&ifaceName, "iface", "", "name of interface to use for multicast") flag.StringVar(&ifaceName, "iface", "", "name of interface to use for multicast")
flag.StringVar(&apiPath, "api", "unix:///var/run/docker.sock", "Path to Docker API socket") flag.StringVar(&apiPath, "api", "unix:///var/run/docker.sock", "Path to Docker API socket")
flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up") flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up")
@@ -29,6 +35,11 @@ func main() {
flag.BoolVar(&debug, "debug", false, "output debugging info to stderr") flag.BoolVar(&debug, "debug", false, "output debugging info to stderr")
flag.Parse() flag.Parse()
if justVersion {
io.WriteString(os.Stdout, fmt.Sprintf("weavedns %s\n", version))
os.Exit(0)
}
debugOut := ioutil.Discard debugOut := ioutil.Discard
if debug { if debug {
debugOut = os.Stderr debugOut = os.Stderr