From e2f4e6254fb4279985aa744ab3bda44af240e7f1 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Fri, 26 Jan 2024 23:38:45 -0800 Subject: [PATCH] modules: fix issue with some module extensions being ignored in dirs (MR 46) There are several valid extensions that kernel modules can have, and the list I had here was not complete... this meant that mkinitfs would fail to include modules with extensions like ".ko.gz" when searching directories. This makes the check for a "valid" module file name a lot simpler, allowing any file with ".ko" in the file name. While it's possible for a non-module file to have ".ko" somewhere in the file name, it seems unlikely if it's in the kernel modules directory... and this is an OK compromise for now. --- internal/filelist/modules/modules.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/filelist/modules/modules.go b/internal/filelist/modules/modules.go index 46c2d4b..d8bff7e 100644 --- a/internal/filelist/modules/modules.go +++ b/internal/filelist/modules/modules.go @@ -118,7 +118,9 @@ func getModulesInDir(modPath string) (files []string, err error) { // Unable to walk path return err } - if filepath.Ext(path) != ".ko" && filepath.Ext(path) != ".xz" { + // this assumes module names are in the format .ko[.format], + // where ".format" (e.g. ".gz") is optional. + if !strings.Contains(".ko", path) { return nil } files = append(files, path)