aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu-ifdown
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2010-10-03 21:39:14 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-07 19:48:17 +0100
commitc8a181e847660bb9d7faedad0bed7d05afbe8103 (patch)
treecf548194e5591459b323b672abda5c759b183791 /scripts/poky-qemu-ifdown
parentfb2430212521680d593c8c725a9dfb635f40bd59 (diff)
downloadopenembedded-core-c8a181e847660bb9d7faedad0bed7d05afbe8103.tar.gz
poky-qemu-ifup/ifdown: Require root privileges to run
This fixes [BUGID #232], requiring root privileges to run these scripts and giving an error prompt when that requirement is not met. The tunctl uid fallback code has also been removed, as we can rely on the specific version of tunctl run from the native sysroot. Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts/poky-qemu-ifdown')
-rwxr-xr-xscripts/poky-qemu-ifdown18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown
index 93a87559af..ece2dc998a 100755
--- a/scripts/poky-qemu-ifdown
+++ b/scripts/poky-qemu-ifdown
@@ -1,6 +1,15 @@
#!/bin/bash
#
-# QEMU network interface configuration script.
+# QEMU network configuration script to bring down tap devices. This
+# utility needs to be run as root, and will use the tunctl binary
+# from a Poky sysroot.
+#
+# If you find yourself calling this script a lot, you can add the
+# the following to your /etc/sudoers file to be able to run this
+# command without entering your password each time:
+#
+# <my-username> ALL=NOPASSWD: /path/to/poky-qemu-ifup
+# <my-username> ALL=NOPASSWD: /path/to/poky-qemu-ifdown
#
# Copyright (c) 2006-2010 Intel Corp.
#
@@ -18,9 +27,14 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
usage() {
- echo "$0 <tap-dev> <native-sysroot-basedir>"
+ echo "sudo $0 <tap-dev> <native-sysroot-basedir>"
}
+if [ $EUID -ne 0 ]; then
+ echo "Error: This script (poky-qemu-ifdown) must be run with root privileges"
+ exit 1
+fi
+
if [ $# -ne 2 ]; then
usage
exit 1