summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-gen-tapdevs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu-gen-tapdevs')
-rwxr-xr-xscripts/runqemu-gen-tapdevs46
1 files changed, 26 insertions, 20 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
index 624deacb70..bfb60f44ae 100755
--- a/scripts/runqemu-gen-tapdevs
+++ b/scripts/runqemu-gen-tapdevs
@@ -69,32 +69,38 @@ if [ ! -x "$IFCONFIG" ]; then
69 exit 1 69 exit 1
70fi 70fi
71 71
72# Ensure we start with a clean slate 72if [ $COUNT -ge 0 ]; then
73for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do 73 # Ensure we start with a clean slate
74 echo "Note: Destroying pre-existing tap interface $tap..." 74 for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
75 $TUNCTL -d $tap 75 echo "Note: Destroying pre-existing tap interface $tap..."
76done 76 $TUNCTL -d $tap
77 77 done
78echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." 78 rm -f /etc/runqemu-nosudo
79for ((index=0; index < $COUNT; index++)); do 79else
80 echo "Creating tap$index" 80 echo "Error: Incorrect count: $COUNT"
81 ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1` 81 exit 1
82 if [ $? -ne 0 ]; then 82fi
83 echo "Error running tunctl: $ifup"
84 exit 1
85 fi
86done
87 83
88if [ $COUNT -gt 0 ]; then 84if [ $COUNT -gt 0 ]; then
85 echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..."
86 for ((index=0; index < $COUNT; index++)); do
87 echo "Creating tap$index"
88 ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1`
89 if [ $? -ne 0 ]; then
90 echo "Error running tunctl: $ifup"
91 exit 1
92 fi
93 done
94
89 echo "Note: For systems running NetworkManager, it's recommended" 95 echo "Note: For systems running NetworkManager, it's recommended"
90 echo "Note: that the tap devices be set as unmanaged in the" 96 echo "Note: that the tap devices be set as unmanaged in the"
91 echo "Note: NetworkManager.conf file. Add the following lines to" 97 echo "Note: NetworkManager.conf file. Add the following lines to"
92 echo "Note: /etc/NetworkManager/NetworkManager.conf" 98 echo "Note: /etc/NetworkManager/NetworkManager.conf"
93 echo "[keyfile]" 99 echo "[keyfile]"
94 echo "unmanaged-devices=interface-name:tap*" 100 echo "unmanaged-devices=interface-name:tap*"
95fi
96 101
97# The runqemu script will check for this file, and if it exists, 102 # The runqemu script will check for this file, and if it exists,
98# will use the existing bank of tap devices without creating 103 # will use the existing bank of tap devices without creating
99# additional ones via sudo. 104 # additional ones via sudo.
100touch /etc/runqemu-nosudo 105 touch /etc/runqemu-nosudo
106fi