[oe-commits] Richard Purdie : scripts: Show sensible warning messages if expected binaries don't exist

git version control git at git.openembedded.org
Fri Sep 2 13:23:56 UTC 2011


Module: openembedded-core.git
Branch: master
Commit: 6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=6b5706d1f9ce7a3fd4d8f819ff8f3fd789665647

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Thu Sep  1 22:04:48 2011 +0100

scripts: Show sensible warning messages if expected binaries don't exist

[YOCTO #1438]

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/oe-find-native-sysroot |    2 +-
 scripts/runqemu-export-rootfs  |    2 +-
 scripts/runqemu-extract-sdk    |    2 +-
 scripts/runqemu-gen-tapdevs    |    4 ++++
 scripts/runqemu-ifup           |   22 +++++++++++++++++-----
 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 b99014b..b2c22aa 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 6f4604d..3ee3112 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 d30e5a6..4b52475 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 9f31387..15bccd4 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 987a37a..870cb6b 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 19f8d3d..4f6909b 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





More information about the Openembedded-commits mailing list