Skip to content

Commit

Permalink
chore(pkg/driver): bump driverkit to v0.18.2 and adjust kernel-downlo…
Browse files Browse the repository at this point in the history
…ad script helper.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Apr 2, 2024
1 parent 8f246a6 commit 70289f4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/driver/distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package driverdistro

import (
"bufio"
"bytes"
"compress/gzip"
"errors"
"fmt"
Expand Down Expand Up @@ -140,8 +142,18 @@ func loadKernelHeadersFromDk(distro string, kr kernelrelease.KernelRelease) (str
if err != nil {
return "", nil, err
}
script += "\necho $KERNELDIR"
out, err := exec.Command("bash", "-c", script).Output() //nolint:gosec // false positive
path := strings.TrimSuffix(string(out), "\n")
var path string
if err == nil {
// Scan all stdout line by line and
// store last line as KERNELDIR path.
reader := bytes.NewReader(out)
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
path = scanner.Text()
}
}
return path, func() {
_ = os.RemoveAll("/tmp/kernel-download")
_ = os.RemoveAll(path)
Expand Down

0 comments on commit 70289f4

Please sign in to comment.