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:20:32 +0100 |
commit | 6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647 (patch) | |
tree | 436599b7eda0bd343518cfcc81e72976dc16444e /scripts | |
parent | 06625096f897235ed85f0d9a1355497f92938454 (diff) | |
download | openembedded-core-6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647.tar.gz openembedded-core-6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647.tar.bz2 openembedded-core-6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647.tar.xz openembedded-core-6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647.zip |
scripts: Show sensible warning messages if expected binaries don't exist
[YOCTO #1438]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/oe-find-native-sysroot | 2 | ||||
-rwxr-xr-x | scripts/runqemu-export-rootfs | 2 | ||||
-rwxr-xr-x | scripts/runqemu-extract-sdk | 2 | ||||
-rwxr-xr-x | scripts/runqemu-gen-tapdevs | 4 | ||||
-rwxr-xr-x | scripts/runqemu-ifup | 22 | ||||
-rwxr-xr-x | scripts/runqemu-internal | 20 |
6 files changed, 40 insertions, 12 deletions
diff --git a/scripts/oe-find-native-sysroot b/scripts/oe-find-native-sysroot index b99014b52..b2c22aaf4 100755 --- a/scripts/oe-find-native-sysroot +++ b/scripts/oe-find-native-sysroot @@ -31,7 +31,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. if [ -z "$OECORE_NATIVE_SYSROOT" ]; then - BITBAKE=`which bitbake` + BITBAKE=`which bitbake 2> /dev/null` if [ "x$BITBAKE" != "x" ]; then if [ "$UID" = "0" ]; then # Root cannot run bitbake unless sanity checking is disabled diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs index 6f4604d9a..3ee311235 100755 --- a/scripts/runqemu-export-rootfs +++ b/scripts/runqemu-export-rootfs @@ -38,7 +38,7 @@ fi # Ensure the nfs-export-dir is an absolute path 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 echo "Error: Unable to find the oe-find-native-sysroot script" echo "Did you forget to source your build environment setup script?" diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk index d30e5a64a..4b5247597 100755 --- a/scripts/runqemu-extract-sdk +++ b/scripts/runqemu-extract-sdk @@ -29,7 +29,7 @@ if [ $# -ne 2 ]; then exit 1 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 echo "Error: Unable to find the oe-find-native-sysroot script" echo "Did you forget to source your build system environment setup script?" diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index 9f313879e..15bccd448 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs @@ -62,6 +62,10 @@ if [ -z "$IFCONFIG" ]; then # Is it ever anywhere else? IFCONFIG=/sbin/ifconfig fi +if [ ! -x "$IFCONFIG" ]; then + echo "$IFCONFIG cannot be executed" + exit 1 +fi # Ensure we start with a clean slate for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }'`; do diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 987a37a1a..870cb6bcb 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup @@ -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 diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 19f8d3de8..4f6909b73 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal @@ -88,8 +88,16 @@ fi # sudo. NOSUDO_FLAG="/etc/runqemu-nosudo" -QEMUIFUP=`which runqemu-ifup` -QEMUIFDOWN=`which runqemu-ifdown` +QEMUIFUP=`which runqemu-ifup 2> /dev/null` +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" @@ -137,6 +145,10 @@ IFCONFIG=`which ifconfig 2> /dev/null` if [ -z "$IFCONFIG" ]; then IFCONFIG=/sbin/ifconfig fi +if [ ! -x "$IFCONFIG" ]; then + echo "$IFCONFIG cannot be executed" + exit 1 +fi POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}'` TAP="" @@ -418,7 +430,7 @@ fi PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH -QEMUBIN=`which $QEMU` +QEMUBIN=`which $QEMU 2> /dev/null` if [ ! -x "$QEMUBIN" ]; then echo "Error: No QEMU binary '$QEMU' could be found." cleanup @@ -434,7 +446,7 @@ function _quit() { return } -DISTCCD=`which distccd` +DISTCCD=`which distccd 2> /dev/null` PIDFILE="" trap _quit INT TERM QUIT |