mirror of
https://github.com/kairos-io/immucore.git
synced 2025-05-09 08:37:20 +00:00
🐛 Get oem label from cmdline before using runtime (#73)
Otherwise we are ignoring any override via stanza Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
parent
ea5c1c75f2
commit
b0b326313b
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/deniswernert/go-fstab"
|
||||
"github.com/kairos-io/kairos/sdk/state"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -233,3 +234,28 @@ func GetOverlayBase() string {
|
||||
return overlayConfig[1]
|
||||
|
||||
}
|
||||
|
||||
// GetOemLabel will ge the oem label to mount, first from the cmdline and if that fails, from the runtime
|
||||
// This way users can override the oem label
|
||||
func GetOemLabel() string {
|
||||
var oemLabel string
|
||||
// Pick both stanzas until we deprecate the cos ones
|
||||
oemLabelCos := ReadCMDLineArg("rd.cos.oemlabel=")
|
||||
oemLabelImmucore := ReadCMDLineArg("rd.immucore.oemlabel=")
|
||||
if len(oemLabelCos) != 0 {
|
||||
oemLabel = oemLabelCos[1]
|
||||
}
|
||||
if len(oemLabelImmucore) != 0 {
|
||||
oemLabel = oemLabelImmucore[1]
|
||||
}
|
||||
|
||||
if oemLabel != "" {
|
||||
return oemLabel
|
||||
}
|
||||
// We could not get it from the cmdline so get it from the runtime
|
||||
runtime, err := state.NewRuntime()
|
||||
if err != nil {
|
||||
Log.Debug().Err(err).Msg("runtime")
|
||||
}
|
||||
return runtime.OEM.Label
|
||||
}
|
||||
|
@ -176,24 +176,18 @@ func (s *State) LoadEnvLayoutDagStep(g *herd.Graph, deps ...string) error {
|
||||
|
||||
// MountOemDagStep will add mounting COS_OEM partition under s.Rootdir + /oem
|
||||
func (s *State) MountOemDagStep(g *herd.Graph, deps ...string) error {
|
||||
runtime, err := state.NewRuntime()
|
||||
if err != nil {
|
||||
internalUtils.Log.Debug().Err(err).Msg("runtime")
|
||||
}
|
||||
return g.Add(cnst.OpMountOEM,
|
||||
herd.WithDeps(deps...),
|
||||
herd.WithCallback(
|
||||
s.MountOP(
|
||||
fmt.Sprintf("/dev/disk/by-label/%s", runtime.OEM.Label),
|
||||
fmt.Sprintf("/dev/disk/by-label/%s", internalUtils.GetOemLabel()),
|
||||
s.path("/oem"),
|
||||
runtime.OEM.Type,
|
||||
internalUtils.DiskFSType(fmt.Sprintf("/dev/disk/by-label/%s", internalUtils.GetOemLabel())),
|
||||
[]string{
|
||||
"rw",
|
||||
"suid",
|
||||
"dev",
|
||||
"exec",
|
||||
//"noauto",
|
||||
//"nouser",
|
||||
"async",
|
||||
}, time.Duration(s.OemTimout)*time.Second),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user