simplify "need to run as root" condition

This commit is contained in:
Matthias Radestock committed 2015-04-11 00:07:23 +01:00
1 parent c2042d52f8
commit 363814db5c
1 file changed
+4 -5
+4 -5
View File
@@ -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