add some basic error handling to 'weave' script

This commit is contained in:
Matthias Radestock committed 2014-08-26 11:54:01 +01:00
1 parent b35f83f132
commit e057799e0c
1 file changed
+13 -1
+13 -1
View File
@@ -8,7 +8,15 @@ MTU=65535
SCRIPT_DIR=$(dirname $(readlink -f $0))
COMMAND=$1
IPADDR=$2
shift 2
usage() {
echo "Usage:"
echo "weave <ipaddr>/<subnet> launch [-passwd <passwd>] <peer_host> ..."
echo "weave <ipaddr>/<subnet> run <docker run args> ..."
exit 1
}
shift 2 || usage
# pre-create bridge so we can set the MTU
[ ! -d /sys/class/net/$BRIDGE ] && {
@@ -40,6 +48,10 @@ case "$COMMAND" in
CONTAINER=$(docker run -d "$@")
IFACE=$CONTAINER_IFNAME
;;
*)
echo "Unknown weave command '$COMMAND'"
usage
;;
esac
# the following borrows from https://github.com/jpetazzo/pipework