Skip to content

Commit

Permalink
fix(cmd/driver,pkg/driver): fixed a check in install.go.
Browse files Browse the repository at this point in the history
Moreover, added a couple of debug logs when automatically fetching headers.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP authored and poiana committed Mar 28, 2024
1 parent e596dea commit 064c201
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/driver/install/install.go
Expand Up @@ -119,12 +119,14 @@ func (o *driverInstallOptions) RunDriverInstall(ctx context.Context) (string, er
return "", nil
}

if o.Distro.String() == driverdistro.UndeterminedDistro && o.Compile {
o.Download = false
o.Printer.Logger.Info(
"Detected an unsupported target system, please get in touch with the Falco community. Trying to compile anyway.")
} else {
return "", fmt.Errorf("detected an unsupported target system, please get in touch with the Falco community")
if o.Distro.String() == driverdistro.UndeterminedDistro {
if o.Compile {
o.Download = false
o.Printer.Logger.Info(
"Detected an unsupported target system, please get in touch with the Falco community. Trying to compile anyway.")
} else {
return "", fmt.Errorf("detected an unsupported target system, please get in touch with the Falco community")
}
}

var (
Expand Down
2 changes: 2 additions & 0 deletions pkg/driver/distro/distro.go
Expand Up @@ -207,11 +207,13 @@ func Build(ctx context.Context,
// If customizeBuild did not set any KERNELDIR env variable,
// try to load kernel headers urls from driverkit.
if _, found := env[drivertype.KernelDirEnv]; !found {
printer.Logger.Debug("Trying to automatically fetch kernel headers.")
kernelHeadersPath, cleaner, err := loadKernelHeadersFromDk(d.String(), kr)
if cleaner != nil {
defer cleaner()
}
if err == nil {
printer.Logger.Debug("Downloaded and extracted kernel headers.", printer.Logger.Args("path", kernelHeadersPath))
env[drivertype.KernelDirEnv] = kernelHeadersPath
}
}
Expand Down

0 comments on commit 064c201

Please sign in to comment.