diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-01 22:04:48 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-02 14:21:30 +0100 |
| commit | d1a84c9f3d387bfeaeaa0007dda8d90164633255 (patch) | |
| tree | f51c9af343a5ab6f3a0990aefeee94d432d1ceea /scripts/runqemu-ifup | |
| parent | c0df2ab7ebac5650e52089ada97e8657f8af3979 (diff) | |
| download | poky-d1a84c9f3d387bfeaeaa0007dda8d90164633255.tar.gz | |
scripts: Show sensible warning messages if expected binaries don't exist
[YOCTO #1438]
(From OE-Core rev: 6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-ifup')
| -rwxr-xr-x | scripts/runqemu-ifup | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 987a37a1a7..870cb6bcb7 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup | |||
| @@ -69,12 +69,29 @@ if [ "x$IFCONFIG" = "x" ]; then | |||
| 69 | # better than nothing... | 69 | # better than nothing... |
| 70 | IFCONFIG=/sbin/ifconfig | 70 | IFCONFIG=/sbin/ifconfig |
| 71 | fi | 71 | fi |
| 72 | if [ ! -x "$IFCONFIG" ]; then | ||
| 73 | echo "$IFCONFIG cannot be executed" | ||
| 74 | exit 1 | ||
| 75 | fi | ||
| 72 | 76 | ||
| 73 | ROUTE=`which route` | 77 | ROUTE=`which route` |
| 74 | if [ "x$ROUTE" = "x" ]; then | 78 | if [ "x$ROUTE" = "x" ]; then |
| 75 | # better than nothing... | 79 | # better than nothing... |
| 76 | ROUTE=/sbin/route | 80 | ROUTE=/sbin/route |
| 77 | fi | 81 | fi |
| 82 | if [ ! -x "$ROUTE" ]; then | ||
| 83 | echo "$ROUTE cannot be executed" | ||
| 84 | exit 1 | ||
| 85 | fi | ||
| 86 | |||
| 87 | IPTABLES=`which iptables 2> /dev/null` | ||
| 88 | if [ "x$IPTABLES" = "x" ]; then | ||
| 89 | IPTABLES=/sbin/iptables | ||
| 90 | fi | ||
| 91 | if [ ! -x "$IPTABLES" ]; then | ||
| 92 | echo "$IPTABLES cannot be executed" | ||
| 93 | exit 1 | ||
| 94 | fi | ||
| 78 | 95 | ||
| 79 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 96 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] |
| 80 | $IFCONFIG $TAP 192.168.7.$n | 97 | $IFCONFIG $TAP 192.168.7.$n |
| @@ -83,11 +100,6 @@ dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | |||
| 83 | $ROUTE add -host 192.168.7.$dest $TAP | 100 | $ROUTE add -host 192.168.7.$dest $TAP |
| 84 | 101 | ||
| 85 | # setup NAT for tap0 interface to have internet access in QEMU | 102 | # setup NAT for tap0 interface to have internet access in QEMU |
| 86 | IPTABLES=`which iptables` | ||
| 87 | if [ "x$IPTABLES" = "x" ]; then | ||
| 88 | IPTABLES=/sbin/iptables | ||
| 89 | fi | ||
| 90 | |||
| 91 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 | 103 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 |
| 92 | echo 1 > /proc/sys/net/ipv4/ip_forward | 104 | echo 1 > /proc/sys/net/ipv4/ip_forward |
| 93 | $IPTABLES -P FORWARD ACCEPT | 105 | $IPTABLES -P FORWARD ACCEPT |
