summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/runqemu-ifup13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index 5dc765dee8..2671451802 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -21,7 +21,7 @@
21# 21#
22 22
23usage() { 23usage() {
24 echo "sudo $(basename $0) <uid> <gid>" 24 echo "sudo $(basename $0) <gid>"
25} 25}
26 26
27if [ $EUID -ne 0 ]; then 27if [ $EUID -ne 0 ]; then
@@ -29,17 +29,20 @@ if [ $EUID -ne 0 ]; then
29 exit 1 29 exit 1
30fi 30fi
31 31
32if [ $# -ne 2 ]; then 32if [ $# -eq 2 ]; then
33 echo "Warning: uid parameter is ignored. It is no longer needed."
34 GROUP="$2"
35elif [ $# -eq 1 ]; then
36 GROUP="$1"
37else
33 usage 38 usage
34 exit 1 39 exit 1
35fi 40fi
36 41
37USERID="-u $1"
38GROUP="-g $2"
39 42
40if taps=$(ip tuntap list 2>/dev/null); then 43if taps=$(ip tuntap list 2>/dev/null); then
41 tap_no=$(( $(echo "$taps" |cut -f 1 -d ":" | sed 's/tap//g' | sort -rn | head -n 1) + 1 )) 44 tap_no=$(( $(echo "$taps" |cut -f 1 -d ":" | sed 's/tap//g' | sort -rn | head -n 1) + 1 ))
42 ip tuntap add tap$tap_no mode tap group $2 && TAP=tap$tap_no 45 ip tuntap add tap$tap_no mode tap group "$GROUP" && TAP=tap$tap_no
43fi 46fi
44 47
45if [ -z $TAP ]; then 48if [ -z $TAP ]; then