mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 11:12:30 +00:00
✨ Conditional for loading oem (#85)
This commit is contained in:
parent
9687ca1ac6
commit
88a2ca8a9b
2
go.mod
2
go.mod
@ -15,6 +15,7 @@ require (
|
||||
github.com/onsi/ginkgo/v2 v2.9.0
|
||||
github.com/onsi/gomega v1.27.2
|
||||
github.com/rs/zerolog v1.29.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spectrocloud-labs/herd v0.4.2
|
||||
github.com/twpayne/go-vfs v1.7.2
|
||||
github.com/urfave/cli/v2 v2.25.0
|
||||
@ -93,7 +94,6 @@ require (
|
||||
github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/shopspring/decimal v1.3.1 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/tredoe/osutil/v2 v2.0.0-rc.16 // indirect
|
||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||
|
6
go.sum
6
go.sum
@ -667,8 +667,6 @@ github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
|
||||
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
||||
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
|
||||
github.com/onsi/ginkgo/v2 v2.1.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
|
||||
github.com/onsi/ginkgo/v2 v2.8.4 h1:gf5mIQ8cLFieruNLAdgijHF1PYfLphKm2dxxcUtcqK0=
|
||||
github.com/onsi/ginkgo/v2 v2.8.4/go.mod h1:427dEDQZkDKsBvCjc2A/ZPefhKxsTTrsQegMlayL730=
|
||||
github.com/onsi/ginkgo/v2 v2.9.0 h1:Tugw2BKlNHTMfG+CheOITkYvk4LAh6MFOvikhGVnhE8=
|
||||
github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk=
|
||||
github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
@ -884,11 +882,9 @@ github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU=
|
||||
github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||
github.com/vishvananda/netlink v0.0.0-20170808154308-f5a6f697a596/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||
github.com/urfave/cli/v2 v2.25.0 h1:ykdZKuQey2zq0yin/l7JOm9Mh+pg72ngYMeB0ABn6q8=
|
||||
github.com/urfave/cli/v2 v2.25.0/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||
github.com/vishvananda/netlink v0.0.0-20170808154308-f5a6f697a596/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
|
||||
|
@ -258,6 +258,7 @@ func GetOemLabel() string {
|
||||
runtime, err := state.NewRuntime()
|
||||
if err != nil {
|
||||
Log.Debug().Err(err).Msg("runtime")
|
||||
return ""
|
||||
}
|
||||
return runtime.OEM.Label
|
||||
}
|
||||
|
1
main.go
1
main.go
@ -43,7 +43,6 @@ func main() {
|
||||
TargetDevice: targetDevice,
|
||||
TargetImage: targetImage,
|
||||
RootMountMode: utils.RootRW(),
|
||||
OemTimout: utils.GetOemTimeout(),
|
||||
OverlayBase: utils.GetOverlayBase(),
|
||||
}
|
||||
|
||||
|
@ -176,6 +176,10 @@ func (s *State) LoadEnvLayoutDagStep(g *herd.Graph, deps ...string) error {
|
||||
func (s *State) MountOemDagStep(g *herd.Graph, deps ...string) error {
|
||||
return g.Add(cnst.OpMountOEM,
|
||||
herd.WithDeps(deps...),
|
||||
herd.EnableIf(func() bool {
|
||||
// Check if we can get the label. If we cant then we don't run this step
|
||||
return internalUtils.GetOemLabel() != ""
|
||||
}),
|
||||
herd.WithCallback(
|
||||
s.MountOP(
|
||||
fmt.Sprintf("/dev/disk/by-label/%s", internalUtils.GetOemLabel()),
|
||||
@ -187,7 +191,7 @@ func (s *State) MountOemDagStep(g *herd.Graph, deps ...string) error {
|
||||
"dev",
|
||||
"exec",
|
||||
"async",
|
||||
}, time.Duration(s.OemTimout)*time.Second),
|
||||
}, time.Duration(internalUtils.GetOemTimeout())*time.Second),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
@ -26,12 +26,9 @@ type State struct {
|
||||
OverlayDirs []string // e.g. /var
|
||||
BindMounts []string // e.g. /etc/kubernetes
|
||||
CustomMounts map[string]string // e.g. diskid : mountpoint
|
||||
|
||||
OverlayBase string // Overlay config, defaults to tmpfs:20%
|
||||
OemTimout int // Time to wait for the oem to time out if not found, defaults to 5s
|
||||
|
||||
StateDir string // e.g. "/usr/local/.state"
|
||||
fstabs []*fstab.Mount
|
||||
OverlayBase string // Overlay config, defaults to tmpfs:20%
|
||||
StateDir string // e.g. "/usr/local/.state"
|
||||
fstabs []*fstab.Mount
|
||||
}
|
||||
|
||||
func (s *State) path(p ...string) string {
|
||||
|
Loading…
Reference in New Issue
Block a user