diff options
| author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-06-22 19:01:26 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-24 12:21:48 +0100 |
| commit | 6321e1fe7ab25fef5300986fe5df35fdb6c28bd7 (patch) | |
| tree | 32c55c7d087cbc02f5dd3620d777c3ef6104f8be | |
| parent | 14dcde95ec24182529ceecf6094a15254abbada8 (diff) | |
| download | poky-6321e1fe7ab25fef5300986fe5df35fdb6c28bd7.tar.gz | |
runqemu-gen-tapdevs: remove uid parameter
The uid parameter is no longer needed since ip tuntap is used
internally. Remove it. Backward compatibility to 3 or 4 parameters is
still supported.
(From OE-Core rev: a11c87b0a13f81beea8a9f33ef8379c9d2593e59)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/runqemu-gen-tapdevs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index 75547c1361..7f67ee5540 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs | |||
| @@ -8,39 +8,42 @@ | |||
| 8 | # SPDX-License-Identifier: GPL-2.0-only | 8 | # SPDX-License-Identifier: GPL-2.0-only |
| 9 | # | 9 | # |
| 10 | 10 | ||
| 11 | uid=`id -u` | ||
| 12 | gid=`id -g` | 11 | gid=`id -g` |
| 13 | if [ -n "$SUDO_UID" ]; then | ||
| 14 | uid=$SUDO_UID | ||
| 15 | fi | ||
| 16 | if [ -n "$SUDO_GID" ]; then | 12 | if [ -n "$SUDO_GID" ]; then |
| 17 | gid=$SUDO_GID | 13 | gid=$SUDO_GID |
| 18 | fi | 14 | fi |
| 19 | 15 | ||
| 20 | usage() { | 16 | usage() { |
| 21 | echo "Usage: sudo $0 <uid> <gid> <num>" | 17 | echo "Usage: sudo $0 <gid> <num>" |
| 22 | echo "Where <uid> is the numeric user id the tap devices will be owned by" | ||
| 23 | echo "Where <gid> is the numeric group id the tap devices will be owned by" | 18 | echo "Where <gid> is the numeric group id the tap devices will be owned by" |
| 24 | echo "<num> is the number of tap devices to create (0 to remove all)" | 19 | echo "<num> is the number of tap devices to create (0 to remove all)" |
| 25 | echo "For example:" | 20 | echo "For example:" |
| 26 | echo "$ bitbake qemu-helper-native" | 21 | echo "$ bitbake qemu-helper-native" |
| 27 | echo "$ sudo $0 $uid $gid 4" | 22 | echo "$ sudo $0 $gid 4" |
| 28 | echo "" | 23 | echo "" |
| 29 | exit 1 | 24 | exit 1 |
| 30 | } | 25 | } |
| 31 | 26 | ||
| 32 | # Allow passing 4 arguments for backward compatibility with warning | 27 | # Allow passing 4 arguments for backward compatibility with warning |
| 33 | if [ $# -eq 4 ]; then | 28 | if [ $# -gt 4 ]; then |
| 34 | echo "Warning: The <native-sysroot-basedir> parameter is no longer needed. Ignoring." | 29 | echo "Error: Incorrect number of arguments" |
| 30 | usage | ||
| 35 | fi | 31 | fi |
| 36 | if [ $# -lt 3 ] || [ $# -gt 4 ]; then | 32 | if [ $# -gt 3 ]; then |
| 33 | echo "Warning: Ignoring the <native-sysroot-basedir> parameter. It is no longer needed." | ||
| 34 | fi | ||
| 35 | if [ $# -gt 2 ]; then | ||
| 36 | echo "Warning: Ignoring the <uid> parameter. It is no longer needed." | ||
| 37 | GID=$2 | ||
| 38 | COUNT=$3 | ||
| 39 | elif [ $# -eq 2 ]; then | ||
| 40 | GID=$1 | ||
| 41 | COUNT=$2 | ||
| 42 | else | ||
| 37 | echo "Error: Incorrect number of arguments" | 43 | echo "Error: Incorrect number of arguments" |
| 38 | usage | 44 | usage |
| 39 | fi | 45 | fi |
| 40 | 46 | ||
| 41 | TUID=$1 | ||
| 42 | GID=$2 | ||
| 43 | COUNT=$3 | ||
| 44 | 47 | ||
| 45 | # check if COUNT is a number and >= 0 | 48 | # check if COUNT is a number and >= 0 |
| 46 | if ! [ $COUNT -ge 0 ]; then | 49 | if ! [ $COUNT -ge 0 ]; then |
| @@ -78,10 +81,10 @@ if [ $COUNT -eq 0 ]; then | |||
| 78 | exit 0 | 81 | exit 0 |
| 79 | fi | 82 | fi |
| 80 | 83 | ||
| 81 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." | 84 | echo "Creating $COUNT tap devices for GID: $GID..." |
| 82 | for ((index=0; index < $COUNT; index++)); do | 85 | for ((index=0; index < $COUNT; index++)); do |
| 83 | echo "Creating tap$index" | 86 | echo "Creating tap$index" |
| 84 | if ! ifup=`$RUNQEMU_IFUP $TUID $GID 2>&1`; then | 87 | if ! ifup=`$RUNQEMU_IFUP $GID 2>&1`; then |
| 85 | echo "Error bringing up interface: $ifup" | 88 | echo "Error bringing up interface: $ifup" |
| 86 | exit 1 | 89 | exit 1 |
| 87 | fi | 90 | fi |
