[arch-projects] [mkinitcpio] [PATCH 1/2] functions: always add toplevel dir in add_full_dir
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- this function could probably use some more cleanup, but i'll save that for another rainy day. functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions b/functions index e54f4bf..4f231b1 100644 --- a/functions +++ b/functions @@ -413,11 +413,12 @@ add_full_dir() { local f= if [[ -n $1 && -d $1 ]]; then + add_dir "$1" + for f in "$1"/*; do if [[ -L $f ]]; then add_symlink "$f" "$(readlink "$f")" elif [[ -d $f ]]; then - add_dir "$f" add_full_dir "$f" elif [[ -f $f ]]; then add_file "$f" -- 1.8.4
As suggested by Harald Hoyer, this is more accurate for the sake of following where udev gets its modaliases from. In some rare cases, it may even be more complete than scraping the raw modalias files. Also, introduce a wrapper around modprobe so that the options passed are never ommitted, or wrongly specified. In this case, a subtle bug with the -r flag is fixed due to using the wrong variable with modprobe's -d flag. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 12 +++++++----- install/autodetect | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/functions b/functions index 4f231b1..f0dce80 100644 --- a/functions +++ b/functions @@ -251,16 +251,18 @@ list_hookpoints() { in_array run_cleanuphook "${funcs[@]}" && msg2 "cleanup hook" } +modprobe() { + command modprobe -d "$_optmoduleroot" -S "$KERNELVERSION" "$@" +} + auto_modules() { # Perform auto detection of modules via sysfs. local mods= - IFS=$'\n' read -rd '' -a mods < \ - <(find /sys/devices -name modalias -exec sort -u {} + | - # delimit each input by a newline, expanded in place - xargs -d $'\n' modprobe -d "$MODULEROOT" -qaRS "$KERNELVERSION" | - sort -u) + mapfile -t mods < <(find /sys/devices -name uevent \ + -exec sort -u {} + | awk -F= '$1 == "MODALIAS" && !_[$0]++') + mapfile -t mods < <(modprobe -qaR "${mods[@]#MODALIAS=}") (( ${#mods[*]} )) && printf "%s\n" "${mods[@]//-/_}" } diff --git a/install/autodetect b/install/autodetect index b3db536..43e8df2 100644 --- a/install/autodetect +++ b/install/autodetect @@ -10,8 +10,7 @@ build() { # treat this as an alias, since ext3 might be aliased to ext4. also, as # of linux 3.9, we can find any filesystem by the alias "fs-$name" # rather than having to guess at the corresponding module name. - IFS=$'\n' read -rd '' -a resolved < \ - <(modprobe -d "$_optmoduleroot" -S "$KERNELVERSION" -Ra {fs-,}"$1" 2>/dev/null) + IFS=$'\n' read -rd '' -a resolved < <(modprobe -Ra {fs-,}"$1" 2>/dev/null) for r in "${resolved[@]}"; do _autodetect_cache["$r"]=1 -- 1.8.4
participants (1)
-
Dave Reisner