diff options
| author | Scott Garman <scott.a.garman@intel.com> | 2010-09-30 20:39:26 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 19:53:46 +0100 |
| commit | 8532405c1d6b2184ca88922506b725110a1f7627 (patch) | |
| tree | 98b676ccdd35f66c9f59898e5752df86e531e0ad /scripts/poky-qemu-internal | |
| parent | 62625d0ca006153169efc3378ad2d30c30e12612 (diff) | |
| download | poky-8532405c1d6b2184ca88922506b725110a1f7627.tar.gz | |
poky-gen-tapdevs: script to create a 'bank' of tap interfaces
This script can be used to create and configure a 'bank' of tap
interfaces that can be used by the poky-qemu script.
It is useful in locked-down enterprise environments where developers
do not have sudo access, but need to be able to run QEMU with
networking. A sysadmin would then use this script to bring up a
number of tap interfaces for the user to make use of.
This fixes [BUGID #391]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts/poky-qemu-internal')
| -rwxr-xr-x | scripts/poky-qemu-internal | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index c3720d9ce2..0ea38eef60 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
| @@ -50,6 +50,10 @@ if [ -z "$QEMU_MEMORY" ]; then | |||
| 50 | 50 | ||
| 51 | fi | 51 | fi |
| 52 | 52 | ||
| 53 | # This flag file is created when poky-gen-tapdevs creates a bank of | ||
| 54 | # tap devices, indicating that the user does not have sudo privs. | ||
| 55 | NOSUDO_FLAG="/etc/poky-nosudo" | ||
| 56 | |||
| 53 | QEMUIFUP=`which poky-qemu-ifup` | 57 | QEMUIFUP=`which poky-qemu-ifup` |
| 54 | QEMUIFDOWN=`which poky-qemu-ifdown` | 58 | QEMUIFDOWN=`which poky-qemu-ifdown` |
| 55 | 59 | ||
| @@ -81,6 +85,13 @@ for tap in $POSSIBLE; do | |||
| 81 | done | 85 | done |
| 82 | 86 | ||
| 83 | if [ "$TAP" = "" ]; then | 87 | if [ "$TAP" = "" ]; then |
| 88 | if [ -e "$NOSUDO_FLAG" ]; then | ||
| 89 | echo "Error: There are no available tap devices to use for networking," | ||
| 90 | echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating" | ||
| 91 | echo "a new one with sudo." | ||
| 92 | exit 1 | ||
| 93 | fi | ||
| 94 | |||
| 84 | GROUPID=`id -g` | 95 | GROUPID=`id -g` |
| 85 | echo 'Setting up tap interface under sudo' | 96 | echo 'Setting up tap interface under sudo' |
| 86 | tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT` | 97 | tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT` |
