usability: check that script is being run as root

so we can display a nicer error if not
This commit is contained in:
Matthias Radestock committed 2014-08-26 13:40:09 +01:00
1 parent 9c5603ebe7
commit fa5a5f46b4
1 file changed
+5
+5
View File
@@ -18,6 +18,11 @@ usage() {
shift 2 || usage
[ `id -u` = 0 ] || {
echo "weave must be run as 'root'"
exit 1
}
# pre-create bridge so we can set the MTU
[ ! -d /sys/class/net/$BRIDGE ] && {
ip link add dev $BRIDGE type bridge