mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-09-21 21:51:34 +02:00
42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
From c37edef1461a629d7cc75defc0c29efd392519ae Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
|
Date: Sat, 2 Apr 2022 06:11:53 +0200
|
|
Subject: [PATCH] generator: lookup executable paths using exec.LookPath
|
|
|
|
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.
|
|
---
|
|
generator/generator.go | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/generator/generator.go b/generator/generator.go
|
|
index 0fedda5..f21da7e 100644
|
|
--- a/generator/generator.go
|
|
+++ b/generator/generator.go
|
|
@@ -5,6 +5,7 @@ import (
|
|
"fmt"
|
|
"net"
|
|
"os"
|
|
+ "os/exec"
|
|
"path/filepath"
|
|
"time"
|
|
|
|
@@ -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 {
|