On Wed, Feb 11, 2009 at 08:35:21PM -0600, Victor Lowther wrote:
> On Wed, Feb 11, 2009 at 6:21 PM, Karel Zak <[email protected]> wrote:
> >
> > I know, that's nit-picking, but I cannot resist ;-)
> >
> > On Wed, Feb 11, 2009 at 03:41:56PM -0800, Victor Lowther wrote:
> >> +find_binary() {
> >> + local binpath="/bin /sbin /usr/bin /usr/sbin" p
btw, what when you want to generate initramfs from a different set of
utils than you have in your standard system? What about to support
something like
dracut --prefix=/usr/local
or follow $PATH rather than hardcode paths to the dracut script.
> >> + [[ ${1##*/} = $1 ]] || { echo $1; return 0; }
> >> + for p in $binpath; do
> >> + [[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
> >> + done
> >> + return 1
> >> +}
> >
> > [...]
> >
> >> + local src=$(find_binary "$1") || {
> >
> > PATH="/bin:/sbin:/usr/bin:/usr/sbin"
> > local src=$(type -Pa "$1")
>
> What will that do when passed an absolute path to a file that is not
> an executable?
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
src=$(type -Pa "$1") || src="$1"
[[ ! -f "$src" ]] && {
echo "Cannot find requested file $1. Exiting."
exit 1
}
... but that's real nit-picking (and I love shell or awk exercises ;-)
Your find_binary() is good of course. I look forward to see your patches
in dracut git repository.
Karel
--
Karel Zak <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html