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?)
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 \
WEAVER_IMAGE=$DOCKERHUB_USER/weave \
WEAVEDNS_IMAGE=$DOCKERHUB_USER/weavedns
+11 -2
View File
@@ -1,6 +1,8 @@
#!/bin/sh
set -e
SCRIPT_VERSION="(unreleased version)"
usage() {
echo "Usage:"
echo "weave launch [-password <password> | -passwordfile <path>] <peer> ..."
@@ -479,14 +481,21 @@ case "$COMMAND" in
;;
version)
[ $# -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='{{ .Id }}' $IMAGE 2>/dev/null) ; then
echo "Unable to find $IMAGE image." >&2
exit 1
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)
[ $# -gt 0 ] || usage
+18 -7
View File
@@ -2,24 +2,30 @@ package main
import (
"flag"
"fmt"
weavedns "github.com/zettio/weave/nameserver"
weavenet "github.com/zettio/weave/net"
"io"
"io/ioutil"
"net"
"os"
)
var version = "(unreleased version)"
func main() {
var (
ifaceName string
apiPath string
dnsPort int
httpPort int
wait int
watch bool
debug bool
justVersion bool
ifaceName string
apiPath string
dnsPort int
httpPort int
wait int
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(&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")
@@ -29,6 +35,11 @@ func main() {
flag.BoolVar(&debug, "debug", false, "output debugging info to stderr")
flag.Parse()
if justVersion {
io.WriteString(os.Stdout, fmt.Sprintf("weavedns %s\n", version))
os.Exit(0)
}
debugOut := ioutil.Discard
if debug {
debugOut = os.Stderr