[arch-projects] [mkinitcpio][PATCH] autodetect: resolve guessed filesystem modules

Dave Reisner d at falconindy.com
Tue Feb 21 18:20:34 EST 2012

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 modules. Treat the output
as an array to be mindful of this.

Fixes FS#28569.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
Unless there's any objections, I'll be backporting this to the current 0.8.2
package and rolling it out into testing (hopefully quickly to core) to avoid
bug reports like the one I've mentioned.

 install/autodetect |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/install/autodetect b/install/autodetect
index 5cc908c..f9a8a7d 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -7,8 +7,14 @@ build() {
     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 ext4.
+        IFS=$'\n' read -rd '' -a resolved < \
+            <(modprobe -S "$KERNELVERSION" -R "$1" 2>/dev/null)
+        if (( ${#resolved[*]} )); then
+            printf '%s\n' "${resolved[@]}" >>"$MODULE_FILE"

More information about the arch-projects mailing list