All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 3/3] runqemu-ifup, runqemu-internal: be wiser when locating the network tools
Date: Thu, 01 Dec 2011 10:48:26 +0000	[thread overview]
Message-ID: <1322736506.17484.104.camel@ted> (raw)
In-Reply-To: <7c75cf6a7d4a3c102f1f44eca16eb5c43c530391.1322731182.git.dexuan.cui@intel.com>

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@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...

Cheers,

Richard




  reply	other threads:[~2011-12-01 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  9:21 [PATCH 0/3] 3 new patches for the self-hosted-image work Dexuan Cui
2011-12-01  9:21 ` [PATCH 1/3] make: expand MAKEFLAGS before we re-exec after rebuilding makefiles Dexuan Cui
2011-12-01  9:22   ` Koen Kooi
2011-12-01 10:44     ` Richard Purdie
2011-12-02  2:11       ` Cui, Dexuan
2011-12-01  9:21 ` [PATCH 2/3] task-self-hosted: install sudo, tun.ko, iptables, libgl and libgl-dev into the target Dexuan Cui
2011-12-01 10:45   ` Richard Purdie
2011-12-01  9:21 ` [PATCH 3/3] runqemu-ifup, runqemu-internal: be wiser when locating the network tools Dexuan Cui
2011-12-01 10:48   ` Richard Purdie [this message]
2011-12-02  2:10     ` Cui, Dexuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322736506.17484.104.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.