From ad8fc74813c494554c603bc33c0a97be56a81fb9 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Wed, 16 Nov 2022 11:44:18 +0100 Subject: [PATCH] arrow_up: Bump repository and drop some workarounds (#434) * :arrow_up: Bump Kairos repositories Signed-off-by: Ettore Di Giacinto * :penguin: Find out which grub to call Signed-off-by: Ettore Di Giacinto Signed-off-by: Ettore Di Giacinto --- pkg/machine/machine.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/machine/machine.go b/pkg/machine/machine.go index 2a42aaf..12c6a26 100644 --- a/pkg/machine/machine.go +++ b/pkg/machine/machine.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "os" + "os/exec" "strings" "github.com/denisbrodbeck/machineid" @@ -136,3 +137,15 @@ func ExecuteCloudConfig(file, stage string) error { _, err := utils.SH(fmt.Sprintf("elemental run-stage -s %s %s", stage, file)) return err } + +func FindCommand(def string, options []string) string { + for _, p := range options { + path, err := exec.LookPath(p) + if err == nil { + return path + } + } + + // Otherwise return default + return def +}