On Mon, 2010-07-05 at 11:24 +0200, Amadeusz Żołnowski wrote: > Matches rules filename if it's specified without prefix number. > --- > dracut-functions | 25 +++++++++++++++++++++++-- > 1 files changed, 23 insertions(+), 2 deletions(-) > > diff --git a/dracut-functions b/dracut-functions > index be6b2e9..1f2528e 100755 > --- a/dracut-functions > +++ b/dracut-functions > @@ -319,11 +319,32 @@ inst_symlink() { > inst "$realsrc" && ln -s "$realsrc" "$target" > } > > -# find a udev rule in the usual places. > +# find a udev rule in the usual places and try to be smart (just a bit). > +# See example: > +# find_rule default.rules > +# find_rule 50-default.rules > +# All of them will return: /lib/udev/rules.d/50-udev-default.rules > +# If there are few matching files, error message is printed. > find_rule() { > + local rule t > + > [[ -f $1 ]] && { echo "$1"; return 0; } > for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do # Parsing the output of ls can lead to strange and subtle bugs. # Use globbing and parameter expansion instead, and go with the first # matching file. local f for f in "$r/$1" "$r/${1%%-*}-udev-%{1##*-}" "$r/"*"$1"; do [[ -f $f ]] || continue echo "$f" return 0 > done > return 1 > } -- Victor Lowther LPIC2 UCP RHCE -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html