summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-ifup
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-09-01 22:04:48 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-09-02 14:21:30 +0100
commitd1a84c9f3d387bfeaeaa0007dda8d90164633255 (patch)
treef51c9af343a5ab6f3a0990aefeee94d432d1ceea /scripts/runqemu-ifup
parentc0df2ab7ebac5650e52089ada97e8657f8af3979 (diff)
downloadpoky-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-xscripts/runqemu-ifup22
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
71fi 71fi
72if [ ! -x "$IFCONFIG" ]; then
73 echo "$IFCONFIG cannot be executed"
74 exit 1
75fi
72 76
73ROUTE=`which route` 77ROUTE=`which route`
74if [ "x$ROUTE" = "x" ]; then 78if [ "x$ROUTE" = "x" ]; then
75 # better than nothing... 79 # better than nothing...
76 ROUTE=/sbin/route 80 ROUTE=/sbin/route
77fi 81fi
82if [ ! -x "$ROUTE" ]; then
83 echo "$ROUTE cannot be executed"
84 exit 1
85fi
86
87IPTABLES=`which iptables 2> /dev/null`
88if [ "x$IPTABLES" = "x" ]; then
89 IPTABLES=/sbin/iptables
90fi
91if [ ! -x "$IPTABLES" ]; then
92 echo "$IPTABLES cannot be executed"
93 exit 1
94fi
78 95
79n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] 96n=$[ (`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
86IPTABLES=`which iptables`
87if [ "x$IPTABLES" = "x" ]; then
88 IPTABLES=/sbin/iptables
89fi
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
92echo 1 > /proc/sys/net/ipv4/ip_forward 104echo 1 > /proc/sys/net/ipv4/ip_forward
93$IPTABLES -P FORWARD ACCEPT 105$IPTABLES -P FORWARD ACCEPT