Skip to content

Commit

Permalink
generator: lookup executable paths using exec.LookPath
Browse files Browse the repository at this point in the history
This fixes an issues I discovered on Alpine when attempting to use
Booster's vconsole feature as the setfont executable is located in
/usr/sbin on Alpine and hence the binary was not found successfully
by the primitive lookup implementation previously provided by Booster.
  • Loading branch information
nmeum authored and anatol committed Apr 13, 2022
1 parent ecd29d7 commit c7e328f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
"time"

Expand Down Expand Up @@ -248,8 +249,13 @@ func (img *Image) appendInitBinary(initBinary string) error {
func (img *Image) appendExtraFiles(binaries []string) error {
for _, f := range binaries {
if !filepath.IsAbs(f) {
// simple names like "strace" are resolved as binaries under /usr/bin
f = "/usr/bin/" + f
// If the given name is not an absolute path, assume that it refers
// to an executable and lookup the path to the executable using $PATH.
var err error
f, err = exec.LookPath(f)
if err != nil {
return err
}
}

if err := img.AppendFile(f); err != nil {
Expand Down

0 comments on commit c7e328f

Please sign in to comment.