[OE-core] [PATCH 2/3] runqemu-gen-tapdevs: Allow run --help without sudo
Robert Yang
liezhi.yang at windriver.com
Thu Dec 27 08:59:42 UTC 2018
Then we can get user's UID and GID rather than hardcode to 1000, e.g.:
$ sudo ../poky/scripts/runqemu-gen-tapdevs 15220 100 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
scripts/runqemu-gen-tapdevs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
index 11de318..67c4fcc 100755
--- a/scripts/runqemu-gen-tapdevs
+++ b/scripts/runqemu-gen-tapdevs
@@ -29,15 +29,10 @@ usage() {
echo "<num> is the number of tap devices to create (0 to remove all)"
echo "<native-sysroot-basedir> is the path to the build system's native sysroot"
echo "e.g. $ bitbake qemu-helper-native"
- echo "$ sudo $0 1000 1000 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin"
+ echo "$ sudo $0 `id -u` `id -g` 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin"
exit 1
}
-if [ $EUID -ne 0 ]; then
- echo "Error: This script must be run with root privileges"
- exit
-fi
-
if [ $# -ne 4 ]; then
echo "Error: Incorrect number of arguments"
usage
@@ -54,6 +49,11 @@ if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then
usage
fi
+if [ $EUID -ne 0 ]; then
+ echo "Error: This script must be run with root privileges"
+ exit
+fi
+
SCRIPT_DIR=`dirname $0`
RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup"
if [ ! -x "$RUNQEMU_IFUP" ]; then
--
2.10.2
More information about the Openembedded-core
mailing list