X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fgrml-vnet;h=7fa0d95c4440395ac6cb55412da22023315401de;hb=bc56d430ed4f7eb77355cd3db871d7a7078d051b;hp=ccf62e93ff45a190fc8c68cc3c4fe26b93d6cde7;hpb=4073ed0aaffad28c78bc68cbf6a08e39dfe778ba;p=grml-network.git diff --git a/sbin/grml-vnet b/sbin/grml-vnet index ccf62e9..7fa0d95 100755 --- a/sbin/grml-vnet +++ b/sbin/grml-vnet @@ -1,6 +1,6 @@ #!/bin/bash -# Filename: grml-addtun -# Purpose: Program to create tun/tap devices and add them to a bridge +# Filename: grml-vnet +# Purpose: program to create tun/tap devices and add them to a bridge # Authors: Michael Gebetsroither # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. @@ -16,6 +16,9 @@ OPT_GROUP_='' OPT_BRIDGE_='' OPT_AUTO_='false' +if [ $(id -ru) -ne 0 ] ; then + echo 1>&2 "Error: please run this script with uid 0 (root)." ; exit 1 +fi function printUsage() { @@ -93,6 +96,12 @@ while getopts "du:g:b:ah" opt; do done shift $(($OPTIND - 1)) +if [[ $# < 1 ]]; then + echo "Error: Please give at least one device" >&2 + printUsage + exit 1 +fi + if [[ $OPT_DEL_ == 'false' ]]; then if [[ $OPT_BRIDGE_ != '' && $OPT_AUTO_ == 'true' ]]; then brctl showmacs "$OPT_BRIDGE_" &>/dev/null || brctl addbr "$OPT_BRIDGE_"