mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-07-09 14:13:07 +00:00
https://go.dev/doc/modules/major-version This way we can bump the kairos dependency on the provider-kairos repo which otherwise produced the error: ``` ~/workspace/kairos/provider-kairos (main)*$ go get -u github.com/kairos-io/kairos@v2.0.0-alpha3 go: github.com/kairos-io/kairos@v2.0.0-alpha3: invalid version: module contains a go.mod file, so module path must match major version ("github.com/kairos-io/kairos/v2") ``` Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> Co-authored-by: Itxaka <itxaka.garcia@spectrocloud.com>
42 lines
868 B
Go
42 lines
868 B
Go
package hook
|
|
|
|
import (
|
|
"github.com/kairos-io/kairos-sdk/bundles"
|
|
"github.com/kairos-io/kairos-sdk/machine"
|
|
config "github.com/kairos-io/kairos/v2/pkg/config"
|
|
)
|
|
|
|
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
|
|
}
|