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>
This commit is contained in:
Richard Purdie
2011-09-01 22:04:48 +01:00
parent c0df2ab7eb
commit d1a84c9f3d
6 changed files with 40 additions and 12 deletions

View File

@@ -69,12 +69,29 @@ if [ "x$IFCONFIG" = "x" ]; then
# better than nothing...
IFCONFIG=/sbin/ifconfig
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
exit 1
fi
ROUTE=`which route`
if [ "x$ROUTE" = "x" ]; then
# better than nothing...
ROUTE=/sbin/route
fi
if [ ! -x "$ROUTE" ]; then
echo "$ROUTE cannot be executed"
exit 1
fi
IPTABLES=`which iptables 2> /dev/null`
if [ "x$IPTABLES" = "x" ]; then
IPTABLES=/sbin/iptables
fi
if [ ! -x "$IPTABLES" ]; then
echo "$IPTABLES cannot be executed"
exit 1
fi
n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
$IFCONFIG $TAP 192.168.7.$n
@@ -83,11 +100,6 @@ dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
$ROUTE add -host 192.168.7.$dest $TAP
# setup NAT for tap0 interface to have internet access in QEMU
IPTABLES=`which iptables`
if [ "x$IPTABLES" = "x" ]; then
IPTABLES=/sbin/iptables
fi
$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
echo 1 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -P FORWARD ACCEPT