mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-07-11 23:18:04 +00:00
* 🤖 Add bundles and sysext test * ✨ Exec bundles also after install * 🤖 Adapt tests * 🎨 Create dir only if doesn't exist * 🎨 Return err on mount * 🎨 Make bundle errors failure as an option * 🎨 Minor fixups * debug * 🤖 Fix spec * 🤖 Get correct version for bundle test * 🎨 Fixups * 🤖 systemd-sysext is available only on opensuse for now
31 lines
603 B
Go
31 lines
603 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")
|
|
}()
|
|
|
|
machine.Mount("COS_OEM", "/oem") //nolint:errcheck
|
|
defer func() {
|
|
machine.Umount("/oem")
|
|
}()
|
|
|
|
opts := c.Install.Bundles.Options()
|
|
err := bundles.RunBundles(opts...)
|
|
if c.FailOnBundleErrors && err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|