2022-09-08 15:39:26 +02:00
|
|
|
package hook
|
|
|
|
|
|
|
|
import (
|
2023-03-30 14:18:53 +03:00
|
|
|
config "github.com/kairos-io/kairos/v2/pkg/config"
|
2022-09-08 15:39:26 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Interface interface {
|
|
|
|
Run(c config.Config) error
|
|
|
|
}
|
|
|
|
|
2023-01-25 13:38:56 +01:00
|
|
|
var AfterInstall = []Interface{
|
2022-09-08 15:39:26 +02:00
|
|
|
&RunStage{}, // Shells out to stages defined from the container image
|
|
|
|
&GrubOptions{}, // Set custom GRUB options
|
2022-10-03 00:16:01 +02:00
|
|
|
&BundleOption{},
|
2023-02-03 11:04:02 +01:00
|
|
|
&CustomMounts{},
|
2022-10-07 13:36:32 +02:00
|
|
|
&Kcrypt{},
|
2022-10-03 00:16:01 +02:00
|
|
|
&Lifecycle{}, // Handles poweroff/reboot by config options
|
2022-09-08 15:39:26 +02:00
|
|
|
}
|
|
|
|
|
2023-02-28 15:57:47 -07:00
|
|
|
var AfterReset = []Interface{}
|
2023-01-25 13:38:56 +01:00
|
|
|
|
2022-10-24 08:34:49 +02:00
|
|
|
var FirstBoot = []Interface{
|
|
|
|
&BundlePostInstall{},
|
|
|
|
&GrubPostInstallOptions{},
|
|
|
|
}
|
|
|
|
|
2022-09-08 15:39:26 +02:00
|
|
|
func Run(c config.Config, hooks ...Interface) error {
|
|
|
|
for _, h := range hooks {
|
|
|
|
if err := h.Run(c); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|