mirror of
https://github.com/kairos-io/immucore.git
synced 2025-08-01 06:29:45 +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"
|
"fmt"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/deniswernert/go-fstab"
|
"github.com/deniswernert/go-fstab"
|
||||||
|
"github.com/kairos-io/kairos/sdk/state"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -233,3 +234,28 @@ func GetOverlayBase() string {
|
|||||||
return overlayConfig[1]
|
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
|
// MountOemDagStep will add mounting COS_OEM partition under s.Rootdir + /oem
|
||||||
func (s *State) MountOemDagStep(g *herd.Graph, deps ...string) error {
|
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,
|
return g.Add(cnst.OpMountOEM,
|
||||||
herd.WithDeps(deps...),
|
herd.WithDeps(deps...),
|
||||||
herd.WithCallback(
|
herd.WithCallback(
|
||||||
s.MountOP(
|
s.MountOP(
|
||||||
fmt.Sprintf("/dev/disk/by-label/%s", runtime.OEM.Label),
|
fmt.Sprintf("/dev/disk/by-label/%s", internalUtils.GetOemLabel()),
|
||||||
s.path("/oem"),
|
s.path("/oem"),
|
||||||
runtime.OEM.Type,
|
internalUtils.DiskFSType(fmt.Sprintf("/dev/disk/by-label/%s", internalUtils.GetOemLabel())),
|
||||||
[]string{
|
[]string{
|
||||||
"rw",
|
"rw",
|
||||||
"suid",
|
"suid",
|
||||||
"dev",
|
"dev",
|
||||||
"exec",
|
"exec",
|
||||||
//"noauto",
|
|
||||||
//"nouser",
|
|
||||||
"async",
|
"async",
|
||||||
}, time.Duration(s.OemTimout)*time.Second),
|
}, time.Duration(s.OemTimout)*time.Second),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user