2023-02-15 22:30:08 +01:00
|
|
|
package mount
|
|
|
|
|
|
|
|
import (
|
2023-03-08 11:45:11 +01:00
|
|
|
cnst "github.com/kairos-io/immucore/internal/constants"
|
2023-02-15 22:30:08 +01:00
|
|
|
"github.com/spectrocloud-labs/herd"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RegisterLiveMedia registers the dag for booting from live media/netboot
|
2023-03-02 16:46:25 +01:00
|
|
|
// This sets the sentinel.
|
2023-02-15 22:30:08 +01:00
|
|
|
func (s *State) RegisterLiveMedia(g *herd.Graph) error {
|
|
|
|
// Maybe LogIfErrorAndPanic ? If no sentinel, a lot of config files are not going to run
|
2023-03-02 16:46:25 +01:00
|
|
|
err := s.LogIfErrorAndReturn(s.WriteSentinelDagStep(g), "write sentinel")
|
2023-03-08 11:45:11 +01:00
|
|
|
|
|
|
|
// Waits for sysroot to be there, just in case
|
|
|
|
s.LogIfError(s.WaitForSysrootDagStep(g), "Waiting for sysroot")
|
|
|
|
// Run rootfs
|
2023-04-12 16:19:21 +02:00
|
|
|
|
|
|
|
// Try to mount oem ONLY if we are on recovery squash
|
|
|
|
// The check to see if its enabled its on the DAG step itself
|
|
|
|
s.LogIfError(s.MountOemDagStep(g, cnst.OpWaitForSysroot), "oem mount")
|
|
|
|
|
|
|
|
s.LogIfError(s.RootfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpWaitForSysroot), herd.WithWeakDeps(cnst.OpMountOEM)), "rootfs stage")
|
2023-03-08 11:45:11 +01:00
|
|
|
// Run initramfs inside the /sysroot chroot!
|
2023-04-12 16:19:21 +02:00
|
|
|
s.LogIfError(s.InitramfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpWaitForSysroot, cnst.OpRootfsHook), herd.WithWeakDeps(cnst.OpMountOEM)), "initramfs stage")
|
2023-02-15 22:30:08 +01:00
|
|
|
return err
|
|
|
|
}
|