From eda4f3ba221508a0cec56d3871e1dedcac509f12 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Mon, 17 Jul 2023 17:27:12 +0100 Subject: [PATCH] filelist/modules: try /usr/lib/modules (MR 39) This is the path used on usrmerge distros, try it first as /lib/modules will implicitly follow the /lib symlink. Signed-off-by: Caleb Connolly --- internal/filelist/modules/modules.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/filelist/modules/modules.go b/internal/filelist/modules/modules.go index d8bff7e..4906e2a 100644 --- a/internal/filelist/modules/modules.go +++ b/internal/filelist/modules/modules.go @@ -33,8 +33,14 @@ func (m *Modules) List() (*filelist.FileList, error) { } files := filelist.NewFileList() + libDir := "/usr/lib/modules" + if exists, err := misc.Exists(libDir); !exists { + libDir = "/lib/modules" + } else if err != nil { + return nil, fmt.Errorf("received unexpected error when getting status for %q: %w", libDir, err) + } - modDir := filepath.Join("/lib/modules", kernVer) + modDir := filepath.Join(libDir, kernVer) if exists, err := misc.Exists(modDir); !exists { // dir /lib/modules/ if kernel built without module support, so just print a message log.Printf("-- kernel module directory not found: %q, not including modules", modDir)