Always mount tmpfs

Even on cd boot. Also delay the cdboot check a bit so we can mount tmpfs
also on cdboot

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka 2023-02-14 12:26:04 +01:00
parent 2aee7ab5a0
commit 3ef3ac0251
2 changed files with 13 additions and 6 deletions

View File

@ -52,14 +52,9 @@ Sends a generic event payload with the configuration found in the scanned direct
return err
}
if cdBoot {
log.Info().Msg("Seems we booted from CD, doing nothing. Bye!")
return nil
}
img := utils.ReadCMDLineArg("cos-img/filename=")
if len(img) == 0 {
if c.Bool("dry-run") {
if c.Bool("dry-run") || cdBoot {
img = []string{"fake"}
} else {
log.Logger.Fatal().Msg("Could not get the image name from cmdline (i.e. cos-img/filename=/cOS/active.img)")

View File

@ -52,6 +52,7 @@ const (
opRootfsHook = "rootfs-hook"
opLoadConfig = "load-config"
opMountTmpfs = "mount-tmpfs"
)
func (s *State) path(p ...string) string {
@ -192,6 +193,17 @@ func (s *State) Register(g *herd.Graph) error {
// TODO: add hooks, fstab (might have missed some), systemd compat
// TODO: We should also set tmpfs here (not -related)
err = g.Add(opMountTmpfs, herd.WithCallback(s.MountOP("tmpfs", "/tmp", "tmpfs", []string{"rw"}, 10*time.Second)))
if err != nil {
s.Logger.Debug().Err(err).Msg("tmpfs mount")
return err
}
if runtime.BootState == state.LiveCD {
s.Logger.Info().Msg("Booting from LiveCD")
return nil
}
// All of this below need to run after rootfs stage runs (so the layout file is created)
// This is legacy - in UKI we don't need to found the img, this needs to run in a conditional
if s.MountRoot {