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:
parent
c0df2ab7eb
commit
d1a84c9f3d
|
@ -31,7 +31,7 @@
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
|
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
|
||||||
BITBAKE=`which bitbake`
|
BITBAKE=`which bitbake 2> /dev/null`
|
||||||
if [ "x$BITBAKE" != "x" ]; then
|
if [ "x$BITBAKE" != "x" ]; then
|
||||||
if [ "$UID" = "0" ]; then
|
if [ "$UID" = "0" ]; then
|
||||||
# Root cannot run bitbake unless sanity checking is disabled
|
# Root cannot run bitbake unless sanity checking is disabled
|
||||||
|
|
|
@ -38,7 +38,7 @@ fi
|
||||||
# Ensure the nfs-export-dir is an absolute path
|
# Ensure the nfs-export-dir is an absolute path
|
||||||
NFS_EXPORT_DIR=$(cd "$2" && pwd)
|
NFS_EXPORT_DIR=$(cd "$2" && pwd)
|
||||||
|
|
||||||
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot`
|
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
|
||||||
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
|
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
|
||||||
echo "Error: Unable to find the oe-find-native-sysroot script"
|
echo "Error: Unable to find the oe-find-native-sysroot script"
|
||||||
echo "Did you forget to source your build environment setup script?"
|
echo "Did you forget to source your build environment setup script?"
|
||||||
|
|
|
@ -29,7 +29,7 @@ if [ $# -ne 2 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot`
|
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
|
||||||
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
|
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
|
||||||
echo "Error: Unable to find the oe-find-native-sysroot script"
|
echo "Error: Unable to find the oe-find-native-sysroot script"
|
||||||
echo "Did you forget to source your build system environment setup script?"
|
echo "Did you forget to source your build system environment setup script?"
|
||||||
|
|
|
@ -62,6 +62,10 @@ if [ -z "$IFCONFIG" ]; then
|
||||||
# Is it ever anywhere else?
|
# Is it ever anywhere else?
|
||||||
IFCONFIG=/sbin/ifconfig
|
IFCONFIG=/sbin/ifconfig
|
||||||
fi
|
fi
|
||||||
|
if [ ! -x "$IFCONFIG" ]; then
|
||||||
|
echo "$IFCONFIG cannot be executed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Ensure we start with a clean slate
|
# Ensure we start with a clean slate
|
||||||
for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }'`; do
|
for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }'`; do
|
||||||
|
|
|
@ -69,12 +69,29 @@ if [ "x$IFCONFIG" = "x" ]; then
|
||||||
# better than nothing...
|
# better than nothing...
|
||||||
IFCONFIG=/sbin/ifconfig
|
IFCONFIG=/sbin/ifconfig
|
||||||
fi
|
fi
|
||||||
|
if [ ! -x "$IFCONFIG" ]; then
|
||||||
|
echo "$IFCONFIG cannot be executed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
ROUTE=`which route`
|
ROUTE=`which route`
|
||||||
if [ "x$ROUTE" = "x" ]; then
|
if [ "x$ROUTE" = "x" ]; then
|
||||||
# better than nothing...
|
# better than nothing...
|
||||||
ROUTE=/sbin/route
|
ROUTE=/sbin/route
|
||||||
fi
|
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 ]
|
n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
|
||||||
$IFCONFIG $TAP 192.168.7.$n
|
$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
|
$ROUTE add -host 192.168.7.$dest $TAP
|
||||||
|
|
||||||
# setup NAT for tap0 interface to have internet access in QEMU
|
# 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
|
$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
$IPTABLES -P FORWARD ACCEPT
|
$IPTABLES -P FORWARD ACCEPT
|
||||||
|
|
|
@ -88,8 +88,16 @@ fi
|
||||||
# sudo.
|
# sudo.
|
||||||
NOSUDO_FLAG="/etc/runqemu-nosudo"
|
NOSUDO_FLAG="/etc/runqemu-nosudo"
|
||||||
|
|
||||||
QEMUIFUP=`which runqemu-ifup`
|
QEMUIFUP=`which runqemu-ifup 2> /dev/null`
|
||||||
QEMUIFDOWN=`which runqemu-ifdown`
|
QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null`
|
||||||
|
if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then
|
||||||
|
echo "runqemu-ifup cannot be found or executed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then
|
||||||
|
echo "runqemu-ifdown cannot be found or executed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
NFSRUNNING="false"
|
NFSRUNNING="false"
|
||||||
|
|
||||||
|
@ -137,6 +145,10 @@ IFCONFIG=`which ifconfig 2> /dev/null`
|
||||||
if [ -z "$IFCONFIG" ]; then
|
if [ -z "$IFCONFIG" ]; then
|
||||||
IFCONFIG=/sbin/ifconfig
|
IFCONFIG=/sbin/ifconfig
|
||||||
fi
|
fi
|
||||||
|
if [ ! -x "$IFCONFIG" ]; then
|
||||||
|
echo "$IFCONFIG cannot be executed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}'`
|
POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}'`
|
||||||
TAP=""
|
TAP=""
|
||||||
|
@ -418,7 +430,7 @@ fi
|
||||||
|
|
||||||
PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
|
PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
|
||||||
|
|
||||||
QEMUBIN=`which $QEMU`
|
QEMUBIN=`which $QEMU 2> /dev/null`
|
||||||
if [ ! -x "$QEMUBIN" ]; then
|
if [ ! -x "$QEMUBIN" ]; then
|
||||||
echo "Error: No QEMU binary '$QEMU' could be found."
|
echo "Error: No QEMU binary '$QEMU' could be found."
|
||||||
cleanup
|
cleanup
|
||||||
|
@ -434,7 +446,7 @@ function _quit() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
DISTCCD=`which distccd`
|
DISTCCD=`which distccd 2> /dev/null`
|
||||||
PIDFILE=""
|
PIDFILE=""
|
||||||
|
|
||||||
trap _quit INT TERM QUIT
|
trap _quit INT TERM QUIT
|
||||||
|
|
Loading…
Reference in New Issue