mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-09-02 15:54:25 +00:00
Make "standard" flavor os-release variables optional (#62)
* Make "standard" flavor os-release variables optional and change ARCH to TARGETARCH to simplify how it's passed down from Earthly in the kairos repo Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> * Add SOFTWARE_VERSION_PREFIX in os-release Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> * Accept SOFTWARE_VERSION_PREFIX in cli Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> * Fix test Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> --------- Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
committed by
GitHub
parent
a8707c113a
commit
74a57eb673
@@ -28,6 +28,14 @@ const (
|
||||
unknown = "unknown"
|
||||
)
|
||||
|
||||
type KeyNotFoundErr struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
func (err KeyNotFoundErr) Error() string {
|
||||
return err.Err.Error()
|
||||
}
|
||||
|
||||
func SH(c string) (string, error) {
|
||||
cmd := exec.Command("/bin/sh", "-c", c)
|
||||
cmd.Env = os.Environ()
|
||||
@@ -83,7 +91,7 @@ func OSRelease(key string, file ...string) (string, error) {
|
||||
// We try with the old naming without the prefix in case the key wasn't found
|
||||
v, exists = release[key]
|
||||
if !exists {
|
||||
return "", fmt.Errorf("%s key not found", kairosKey)
|
||||
return "", KeyNotFoundErr{Err: fmt.Errorf("%s key not found", kairosKey)}
|
||||
}
|
||||
}
|
||||
return v, nil
|
||||
|
Reference in New Issue
Block a user