summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-gen-tapdevs
diff options
context:
space:
mode:
authorElizabeth Flanagan <elizabeth.flanagan@intel.com>2012-07-31 11:00:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-02 23:01:34 +0100
commitdee07308c170afca44748aebab768f461e6208ac (patch)
tree3ba3d8e21736b1863b51eb55e5a1ec57ef154d3f /scripts/runqemu-gen-tapdevs
parentc4a7517f8ae6e176a0b8e59b1176cf65bb45aa78 (diff)
downloadpoky-dee07308c170afca44748aebab768f461e6208ac.tar.gz
runqemu-gen-tapdevs: add UID to CL options
runqemu-if* now requires UID as a command line option which means runqemu-gen-tapdevs needs to take it as an option. (From OE-Core rev: a624ec02c4acec83efbe66406f22abafbdce5d63) Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-gen-tapdevs')
-rwxr-xr-xscripts/runqemu-gen-tapdevs16
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
25usage() { 25usage() {
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
36fi 37fi
37 38
38if [ $# -ne 3 ]; then 39if [ $# -ne 4 ]; then
39 echo "Error: Incorrect number of arguments" 40 echo "Error: Incorrect number of arguments"
40 usage 41 usage
41fi 42fi
42 43
43GID=$1 44TUID=$1
44COUNT=$2 45GID=$2
45SYSROOT=$3 46COUNT=$3
47SYSROOT=$4
46 48
47TUNCTL=$SYSROOT/usr/bin/tunctl 49TUNCTL=$SYSROOT/usr/bin/tunctl
48if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then 50if [[ ! -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
74done 76done
75 77
76echo "Creating $COUNT tap devices for GID $GID..." 78echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..."
77for ((index=0; index < $COUNT; index++)); do 79for ((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