Add missing modules and fix rootfs stage

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
This commit is contained in:
Itxaka 2023-02-07 20:16:02 +01:00
parent 717851b0b2
commit 63679b6df1
2 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,8 @@ install() {
# Add missing elemental binary, drop once we get yip lib inside immucore as its only needed to run the stages
inst_multiple immucore elemental
# add utils used by elemental or stages
inst_multiple partprobe sync udevadm parted mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.vfat mkfs.fat mkfs.xfs blkid e2fsck resize2fs mount xfs_growfs umount sgdisk
inst_script "${moddir}/generator.sh" "${systemdutildir}/system-generators/immucore-generator"
inst_simple "${moddir}/immucore.service" "${systemdsystemunitdir}/immucore.service"
mkdir -p "${initdir}/${systemdsystemunitdir}/initrd-fs.target.requires"

View File

@ -84,10 +84,17 @@ func (s *State) WriteFstab(fstabFile string) func(context.Context) error {
}
}
// ln -sf -t / /sysroot/system
func (s *State) RunStageOp(stage string) func(context.Context) error {
return func(ctx context.Context) error {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()
if stage == "rootfs" {
err := os.Symlink("/sysroot/system/", "/system/")
if err != nil {
s.Logger.Err(err).Msg("creating symlink")
return err
}
}
cmd := fmt.Sprintf("elemental run-stage %s", stage)
log.Logger.Debug().Str("cmd", cmd).Msg("")
output, err := utils.SH(cmd)
@ -273,7 +280,7 @@ func (s *State) Register(g *herd.Graph) error {
s.Logger.Debug().Str("what", opRootfsHook).Msg("Add operation")
err = g.Add(opRootfsHook, mountRootCondition, herd.WithDeps(opMountOEM), herd.WithCallback(s.RunStageOp("rootfs")))
if err != nil {
s.Logger.Err(err)
s.Logger.Err(err).Msg("")
}
// /run/cos-layout.env