mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-07-01 18:41:54 +00:00
* 🎨 Do not need to prefix '.' on queries * ✨ Add recovery to stateapi * ✨ Add cloudconfig SDK * ✨ Unify post-install/firstboot hooks This also adds capabilities to add grub option at first boot rather than after installation as for bundles. * 🤖 Optimize tests to wait for state to change
42 lines
865 B
Go
42 lines
865 B
Go
package hook
|
|
|
|
import (
|
|
config "github.com/kairos-io/kairos/pkg/config"
|
|
"github.com/kairos-io/kairos/pkg/machine"
|
|
"github.com/kairos-io/kairos/sdk/bundles"
|
|
)
|
|
|
|
type BundleOption struct{}
|
|
|
|
func (b BundleOption) Run(c config.Config) error {
|
|
|
|
machine.Mount("COS_PERSISTENT", "/usr/local") //nolint:errcheck
|
|
defer func() {
|
|
machine.Umount("/usr/local") //nolint:errcheck
|
|
}()
|
|
|
|
machine.Mount("COS_OEM", "/oem") //nolint:errcheck
|
|
defer func() {
|
|
machine.Umount("/oem") //nolint:errcheck
|
|
}()
|
|
|
|
opts := c.Install.Bundles.Options()
|
|
err := bundles.RunBundles(opts...)
|
|
if c.FailOnBundleErrors && err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type BundlePostInstall struct{}
|
|
|
|
func (b BundlePostInstall) Run(c config.Config) error {
|
|
opts := c.Bundles.Options()
|
|
err := bundles.RunBundles(opts...)
|
|
if c.FailOnBundleErrors && err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|