mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 19:16:59 +00:00
* Add tests and fix some issues that arised from testing Mainly around the cmdargs and how many items it returns. Also drop the iso target and jobs as its not necessary now Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com> * Lint Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com> --------- Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
53 lines
1.9 KiB
Go
53 lines
1.9 KiB
Go
package mount
|
|
|
|
import (
|
|
cnst "github.com/kairos-io/immucore/internal/constants"
|
|
"github.com/spectrocloud-labs/herd"
|
|
)
|
|
|
|
// RegisterUKI registers the dag for booting from UKI.
|
|
func (s *State) RegisterUKI(g *herd.Graph) error {
|
|
// Write sentinel
|
|
s.LogIfError(s.WriteSentinelDagStep(g), "sentinel")
|
|
|
|
s.LogIfError(s.LoadKernelModules(g), "kernel modules")
|
|
|
|
// Udev for devices discovery
|
|
s.LogIfError(s.UKIUdevDaemon(g), "udev")
|
|
|
|
// Run rootfs stage
|
|
s.LogIfError(s.RootfsStageDagStep(g, cnst.OpSentinel), "uki rootfs")
|
|
|
|
// Remount root RO
|
|
s.LogIfError(s.UKIRemountRootRODagStep(g, cnst.OpRootfsHook), "remount root")
|
|
|
|
// Mount base overlay under /run/overlay
|
|
s.LogIfError(s.MountBaseOverlayDagStep(g), "base overlay")
|
|
|
|
// Populate state bind mounts, overlay mounts, custom-mounts from /run/cos/cos-layout.env
|
|
// Requires stage rootfs to have run, which usually creates the cos-layout.env file
|
|
s.LogIfError(s.LoadEnvLayoutDagStep(g, cnst.OpRootfsHook), "loading cos-layout.env")
|
|
|
|
// Mount custom overlays loaded from the /run/cos/cos-layout.env file
|
|
s.LogIfError(s.MountCustomOverlayDagStep(g), "custom overlays mount")
|
|
|
|
// Mount custom mounts loaded from the /run/cos/cos-layout.env file
|
|
s.LogIfError(s.MountCustomMountsDagStep(g), "custom mounts mount")
|
|
|
|
// Mount custom binds loaded from the /run/cos/cos-layout.env file
|
|
// Depends on mount binds as that usually mounts COS_PERSISTENT
|
|
s.LogIfError(s.MountCustomBindsDagStep(g), "custom binds mount")
|
|
|
|
// run initramfs stage
|
|
s.LogIfError(s.InitramfsStageDagStep(g, cnst.OpMountBind), "uki initramfs")
|
|
|
|
s.LogIfError(g.Add(cnst.OpWriteFstab,
|
|
herd.WithDeps(cnst.OpLoadConfig, cnst.OpCustomMounts, cnst.OpMountBind, cnst.OpOverlayMount),
|
|
herd.WeakDeps,
|
|
herd.WithCallback(s.WriteFstab(s.path("/etc/fstab")))), "fstab")
|
|
|
|
// Handover to /sbin/init
|
|
_ = s.UKIBootInitDagStep(g, cnst.OpRemountRootRO, cnst.OpRootfsHook, cnst.OpInitramfsHook)
|
|
return nil
|
|
}
|