refactor: move "need to run as root" check
to a more obvious place
This commit is contained in:
1 parent
74f77a71ce
commit
7752d6b102
1 file changed
+5
-4
@@ -73,10 +73,6 @@ exec_remote() {
|
|||||||
if [ "$1" = "--local" ]; then
|
if [ "$1" = "--local" ]; then
|
||||||
LOCAL="$1"
|
LOCAL="$1"
|
||||||
shift 1
|
shift 1
|
||||||
[ $(id -u) = 0 ] || {
|
|
||||||
echo "weave must be run as 'root' when run locally" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
elif [ "$1" != "run" ]; then
|
elif [ "$1" != "run" ]; then
|
||||||
exec_remote "$@"
|
exec_remote "$@"
|
||||||
exit $?
|
exit $?
|
||||||
@@ -564,6 +560,11 @@ populate_dns() {
|
|||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
if [ -n "$LOCAL" ]; then
|
if [ -n "$LOCAL" ]; then
|
||||||
|
[ $(id -u) = 0 ] || {
|
||||||
|
echo "weave must be run as 'root' when run locally" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
uname -s -r | sed -n -e 's|^\([^ ]*\) \([0-9][0-9]*\)\.\([0-9][0-9]*\).*|\1 \2 \3|p' | {
|
uname -s -r | sed -n -e 's|^\([^ ]*\) \([0-9][0-9]*\)\.\([0-9][0-9]*\).*|\1 \2 \3|p' | {
|
||||||
if ! read sys maj min ; then
|
if ! read sys maj min ; then
|
||||||
echo "ERROR: Unable to parse operating system version $(uname -s -r)" >&2
|
echo "ERROR: Unable to parse operating system version $(uname -s -r)" >&2
|
||||||
|
|||||||
Reference in new issue
Block a user