summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-02-21 22:47:56 +0100
committerDave Reisner <dreisner@archlinux.org>2012-02-22 02:54:06 +0100
commitbe9a42675f3ea125c9daa45986a3b58ba8bae226 (patch)
treeb144c540d816efdafe2d16175c3af6ccdb8d463c
parenta8beffd774be11956041997224878202d1aa970f (diff)
downloadmkinitcpio-be9a42675f3ea125c9daa45986a3b58ba8bae226.tar.gz
mkinitcpio-be9a42675f3ea125c9daa45986a3b58ba8bae226.tar.xz
autodetect: resolve guessed filesystem modules
Trading out modinfo for modprobe allows us to detect filesystems like ext2 and ext3 which might be aliased to ext4 in the case of Kconfig CONFIG_EXT4_USE_FOR_EXT23 being enabled. Maybe this catches other insane corner cases, too. Since we now treat this as possible aliases, we also need to be mindful of the fact that it could resolve to multiple module names. Assign the output as an array to respect this. Fixes FS#28569. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--install/autodetect10
1 files changed, 8 insertions, 2 deletions
diff --git a/install/autodetect b/install/autodetect
index 5cc908c..cc12124 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -7,8 +7,14 @@ build() {
MODULE_FILE=$workdir/autodetect_modules
add_if_avail() {
- if modinfo -k "$KERNELVERSION" "$1" &>/dev/null; then
- printf '%s\n' "$1" >>"$MODULE_FILE"
+ local resolved
+
+ # treat this as an alias, since ext3 might be aliased to ext4.
+ IFS=$'\n' read -rd '' -a resolved < \
+ <(modprobe -S "$KERNELVERSION" -R "$1" 2>/dev/null)
+
+ if (( ${#resolved[*]} )); then
+ printf '%s\n' "${resolved[@]}" >>"$MODULE_FILE"
fi
}