mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-02 00:27:46 +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
29 lines
620 B
Go
29 lines
620 B
Go
package hook
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
config "github.com/kairos-io/kairos/pkg/config"
|
|
"github.com/kairos-io/kairos/pkg/machine"
|
|
"github.com/kairos-io/kairos/pkg/utils"
|
|
)
|
|
|
|
type GrubOptions struct{}
|
|
|
|
func (b GrubOptions) Run(c config.Config) error {
|
|
|
|
machine.Mount("COS_OEM", "/tmp/oem") //nolint:errcheck
|
|
defer func() {
|
|
machine.Umount("/tmp/oem")
|
|
}()
|
|
for k, v := range c.Install.GrubOptions {
|
|
out, err := utils.SH(fmt.Sprintf("grub2-editenv /tmp/oem/grubenv set %s=%s", k, v))
|
|
if err != nil {
|
|
fmt.Printf("could not set boot option: %s\n", out+err.Error())
|
|
return nil // do not error out
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|