On Fri, 2009-02-27 at 14:28 +0100, Seewer Philippe wrote:
> find_binary inside dracut-functions always succeeds. Independent of
> whether the file actually exists or not.
>
> This patch fixes this.
>
> And since we're using the function not only to find binaries at little
> enhancement there shouldn't be that bad either.
>
[snip patch]
Hmmm... a bit wordy. Why not
diff --git a/dracut-functions b/dracut-functions
index 852ce36..f11d372 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -53,9 +53,9 @@ inst_library() {
fi
}
-find_binary() {
+find_file() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
- [[ ${1##*/} = $1 ]] || { echo $1; return 0; }
+ [[ ${1##*/} != $1 && -e $1 ]] && { echo $1; return 0; }
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
@@ -134,7 +134,7 @@ inst() {
echo "usage: inst <file> <root> [<destination file>]"
return 1
fi
- local src=$(find_binary "$1") || {
+ local src=$(find_file "$1") || {
echo "Cannot find requested file $1. Exiting."
exit 1
}
> --
> 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
--
Victor Lowther
RHCE# 805008539634727
LPIC-2# LPI000140019
--
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