[OE-core] [PATCH 3/3] runqemu-ifup, runqemu-internal: be wiser when locating the network tools

Cui, Dexuan dexuan.cui at intel.com
Fri Dec 2 02:10:05 UTC 2011


Richard Purdie wrote on 2011-12-01:
> On Thu, 2011-12-01 at 17:21 +0800, Dexuan Cui wrote:
>> 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 <dexuan.cui at intel.com>
>> ---
>>  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
> 
> I don't really like this, its getting hard to understand whats going on.
> Can we abstract this to a function which tries PATH, then tries our
> own PATH_TMP? This would reduce code duplication and makes it clearer
> what the code is doing...
Good suggestion! 
I'll re-make the patch and re-send it out.
BTW, since I'll be on leave later today, I might not be able to finish this today.
I discussed with Saul and he could kindly help me to finish this. :-)

Thanks,
-- Dexuan






More information about the Openembedded-core mailing list