diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/runqemu-gen-tapdevs | 27 |
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 | ||
| 25 | uid=`id -u` | ||
| 26 | gid=`id -g` | ||
| 27 | if [ -n "$SUDO_UID" ]; then | ||
| 28 | uid=$SUDO_UID | ||
| 29 | fi | ||
| 30 | if [ -n "$SUDO_GID" ]; then | ||
| 31 | gid=$SUDO_GID | ||
| 32 | fi | ||
| 33 | |||
| 25 | usage() { | 34 | usage() { |
| 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 | ||
| 36 | if [ $EUID -ne 0 ]; then | ||
| 37 | echo "Error: This script must be run with root privileges" | ||
| 38 | exit | ||
| 39 | fi | ||
| 40 | |||
| 41 | if [ $# -ne 4 ]; then | 47 | if [ $# -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 |
| 55 | fi | 61 | fi |
| 56 | 62 | ||
| 63 | if [ $EUID -ne 0 ]; then | ||
| 64 | echo "Error: This script must be run with root privileges" | ||
| 65 | exit | ||
| 66 | fi | ||
| 67 | |||
| 57 | SCRIPT_DIR=`dirname $0` | 68 | SCRIPT_DIR=`dirname $0` |
| 58 | RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup" | 69 | RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup" |
| 59 | if [ ! -x "$RUNQEMU_IFUP" ]; then | 70 | if [ ! -x "$RUNQEMU_IFUP" ]; then |
