When working on the self-hosted-image work, I found the PATH variable in the Level-1 target doesn't have /sbin and /usr/sbin, so "runqemu" can't run properly since the tools are installeld at /sbin/ifconfig /sbin/route /usr/sbin/iptables
The patch is used to fix the issue by setting a temp PATH when running which. Signed-off-by: Dexuan Cui <[email protected]> --- scripts/runqemu-ifup | 8 +++++--- scripts/runqemu-internal | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 870cb6b..9e697a8 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup @@ -64,7 +64,9 @@ if [ $STATUS -ne 0 ]; then exit 1 fi -IFCONFIG=`which ifconfig 2> /dev/null` +PATH_TMP="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" + +IFCONFIG=`{ PATH=$PATH:$PATH_TMP; which ifconfig 2> /dev/null; }` if [ "x$IFCONFIG" = "x" ]; then # better than nothing... IFCONFIG=/sbin/ifconfig @@ -74,7 +76,7 @@ if [ ! -x "$IFCONFIG" ]; then exit 1 fi -ROUTE=`which route` +ROUTE=`{ PATH=$PATH:$PATH_TMP; which route 2>/dev/null; }` if [ "x$ROUTE" = "x" ]; then # better than nothing... ROUTE=/sbin/route @@ -84,7 +86,7 @@ if [ ! -x "$ROUTE" ]; then exit 1 fi -IPTABLES=`which iptables 2> /dev/null` +IPTABLES=`{ PATH=$PATH:$PATH_TMP; which iptables 2> /dev/null; }` if [ "x$IPTABLES" = "x" ]; then IPTABLES=/sbin/iptables fi diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 2968ed9..3214fde 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal @@ -141,7 +141,8 @@ if [ ! -d "$LOCKDIR" ]; then chmod 777 $LOCKDIR fi -IFCONFIG=`which ifconfig 2> /dev/null` +PATH_TMP="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" +IFCONFIG=`{ PATH=$PATH:$PATH_TMP; which ifconfig 2> /dev/null; }` if [ -z "$IFCONFIG" ]; then IFCONFIG=/sbin/ifconfig fi -- 1.7.6 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
