diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/runqemu-gen-tapdevs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index 15bccd4484..2c1ff0eefb 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs | |||
| @@ -23,7 +23,8 @@ | |||
| 23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 | 24 | ||
| 25 | usage() { | 25 | usage() { |
| 26 | echo "Usage: sudo $0 <gid> <num> <native-sysroot-basedir>" | 26 | echo "Usage: sudo $0 <uid> <gid> <num> <native-sysroot-basedir>" |
| 27 | echo "Where <uid> is the numeric user id the tap devices will be owned by" | ||
| 27 | echo "Where <gid> is the numeric group id the tap devices will be owned by" | 28 | echo "Where <gid> is the numeric group id the tap devices will be owned by" |
| 28 | echo "<num> is the number of tap devices to create (0 to remove all)" | 29 | echo "<num> is the number of tap devices to create (0 to remove all)" |
| 29 | echo "<native-sysroot-basedir> is the path to the build system's native sysroot" | 30 | echo "<native-sysroot-basedir> is the path to the build system's native sysroot" |
| @@ -35,14 +36,15 @@ if [ $EUID -ne 0 ]; then | |||
| 35 | exit | 36 | exit |
| 36 | fi | 37 | fi |
| 37 | 38 | ||
| 38 | if [ $# -ne 3 ]; then | 39 | if [ $# -ne 4 ]; then |
| 39 | echo "Error: Incorrect number of arguments" | 40 | echo "Error: Incorrect number of arguments" |
| 40 | usage | 41 | usage |
| 41 | fi | 42 | fi |
| 42 | 43 | ||
| 43 | GID=$1 | 44 | TUID=$1 |
| 44 | COUNT=$2 | 45 | GID=$2 |
| 45 | SYSROOT=$3 | 46 | COUNT=$3 |
| 47 | SYSROOT=$4 | ||
| 46 | 48 | ||
| 47 | TUNCTL=$SYSROOT/usr/bin/tunctl | 49 | TUNCTL=$SYSROOT/usr/bin/tunctl |
| 48 | if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then | 50 | if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then |
| @@ -73,10 +75,10 @@ for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }'`; do | |||
| 73 | $TUNCTL -d $tap | 75 | $TUNCTL -d $tap |
| 74 | done | 76 | done |
| 75 | 77 | ||
| 76 | echo "Creating $COUNT tap devices for GID $GID..." | 78 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." |
| 77 | for ((index=0; index < $COUNT; index++)); do | 79 | for ((index=0; index < $COUNT; index++)); do |
| 78 | echo "Creating tap$index" | 80 | echo "Creating tap$index" |
| 79 | ifup=`$RUNQEMU_IFUP $GID $SYSROOT 2>&1` | 81 | ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1` |
| 80 | if [ $? -ne 0 ]; then | 82 | if [ $? -ne 0 ]; then |
| 81 | echo "Error running tunctl: $ifup" | 83 | echo "Error running tunctl: $ifup" |
| 82 | exit 1 | 84 | exit 1 |
