From 363814db5cbb3e7046942abf3d3f05084ddcd0a1 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 11 Apr 2015 00:07:23 +0100 Subject: [PATCH] simplify "need to run as root" condition --- weave | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/weave b/weave index 63993143..0eb30edf 100755 --- a/weave +++ b/weave @@ -72,16 +72,15 @@ exec_remote() { if [ "$1" = "--local" ]; then LOCAL="$1" shift 1 + [ $(id -u) = 0 ] || { + echo "weave must be run as 'root' when run locally" >&2 + exit 1 + } elif [ "$1" != "run" ]; then exec_remote "$@" exit $? fi -[ $(id -u) = 0 ] || ([ "$1" = "run" ] && [ -z "$LOCAL" ]) || { - echo "weave must be run as 'root' when run locally" >&2 - exit 1 -} - CONTAINER_NAME=${WEAVE_CONTAINER_NAME:-weave} DNS_CONTAINER_NAME=weavedns BRIDGE=weave