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.
This commit is contained in:
Clayton Craft
2024-01-26 23:38:45 -08:00
parent 2efeb4510d
commit e2f4e6254f

View File

@@ -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 <name>.ko[.format],
// where ".format" (e.g. ".gz") is optional.
if !strings.Contains(".ko", path) {
return nil
}
files = append(files, path)