summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@gmail.com>2023-06-22 19:01:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-24 12:21:48 +0100
commit6321e1fe7ab25fef5300986fe5df35fdb6c28bd7 (patch)
tree32c55c7d087cbc02f5dd3620d777c3ef6104f8be
parent14dcde95ec24182529ceecf6094a15254abbada8 (diff)
downloadpoky-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-xscripts/runqemu-gen-tapdevs33
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
11uid=`id -u`
12gid=`id -g` 11gid=`id -g`
13if [ -n "$SUDO_UID" ]; then
14 uid=$SUDO_UID
15fi
16if [ -n "$SUDO_GID" ]; then 12if [ -n "$SUDO_GID" ]; then
17 gid=$SUDO_GID 13 gid=$SUDO_GID
18fi 14fi
19 15
20usage() { 16usage() {
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
33if [ $# -eq 4 ]; then 28if [ $# -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
35fi 31fi
36if [ $# -lt 3 ] || [ $# -gt 4 ]; then 32if [ $# -gt 3 ]; then
33 echo "Warning: Ignoring the <native-sysroot-basedir> parameter. It is no longer needed."
34fi
35if [ $# -gt 2 ]; then
36 echo "Warning: Ignoring the <uid> parameter. It is no longer needed."
37 GID=$2
38 COUNT=$3
39elif [ $# -eq 2 ]; then
40 GID=$1
41 COUNT=$2
42else
37 echo "Error: Incorrect number of arguments" 43 echo "Error: Incorrect number of arguments"
38 usage 44 usage
39fi 45fi
40 46
41TUID=$1
42GID=$2
43COUNT=$3
44 47
45# check if COUNT is a number and >= 0 48# check if COUNT is a number and >= 0
46if ! [ $COUNT -ge 0 ]; then 49if ! [ $COUNT -ge 0 ]; then
@@ -78,10 +81,10 @@ if [ $COUNT -eq 0 ]; then
78 exit 0 81 exit 0
79fi 82fi
80 83
81echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." 84echo "Creating $COUNT tap devices for GID: $GID..."
82for ((index=0; index < $COUNT; index++)); do 85for ((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