summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/runqemu-gen-tapdevs27
1 files changed, 19 insertions, 8 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
index 11de318c1a..869fee261d 100755
--- a/scripts/runqemu-gen-tapdevs
+++ b/scripts/runqemu-gen-tapdevs
@@ -22,22 +22,28 @@
22# with this program; if not, write to the Free Software Foundation, Inc., 22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
25uid=`id -u`
26gid=`id -g`
27if [ -n "$SUDO_UID" ]; then
28 uid=$SUDO_UID
29fi
30if [ -n "$SUDO_GID" ]; then
31 gid=$SUDO_GID
32fi
33
25usage() { 34usage() {
26 echo "Usage: sudo $0 <uid> <gid> <num> <staging_bindir_native>" 35 echo "Usage: sudo $0 <uid> <gid> <num> <staging_bindir_native>"
27 echo "Where <uid> is the numeric user id the tap devices will be owned by" 36 echo "Where <uid> is the numeric user id the tap devices will be owned by"
28 echo "Where <gid> is the numeric group id the tap devices will be owned by" 37 echo "Where <gid> is the numeric group id the tap devices will be owned by"
29 echo "<num> is the number of tap devices to create (0 to remove all)" 38 echo "<num> is the number of tap devices to create (0 to remove all)"
30 echo "<native-sysroot-basedir> is the path to the build system's native sysroot" 39 echo "<native-sysroot-basedir> is the path to the build system's native sysroot"
31 echo "e.g. $ bitbake qemu-helper-native" 40 echo "For example:"
32 echo "$ sudo $0 1000 1000 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin" 41 echo "$ bitbake qemu-helper-native"
42 echo "$ sudo $0 $uid $gid 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin"
43 echo ""
33 exit 1 44 exit 1
34} 45}
35 46
36if [ $EUID -ne 0 ]; then
37 echo "Error: This script must be run with root privileges"
38 exit
39fi
40
41if [ $# -ne 4 ]; then 47if [ $# -ne 4 ]; then
42 echo "Error: Incorrect number of arguments" 48 echo "Error: Incorrect number of arguments"
43 usage 49 usage
@@ -54,6 +60,11 @@ if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then
54 usage 60 usage
55fi 61fi
56 62
63if [ $EUID -ne 0 ]; then
64 echo "Error: This script must be run with root privileges"
65 exit
66fi
67
57SCRIPT_DIR=`dirname $0` 68SCRIPT_DIR=`dirname $0`
58RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup" 69RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup"
59if [ ! -x "$RUNQEMU_IFUP" ]; then 70if [ ! -x "$RUNQEMU_IFUP" ]; then