2022-09-08 13:39:26 +00:00
|
|
|
package hook
|
|
|
|
|
|
|
|
import (
|
2022-09-17 16:43:51 +00:00
|
|
|
config "github.com/kairos-io/kairos/pkg/config"
|
2022-09-08 13:39:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Interface interface {
|
|
|
|
Run(c config.Config) error
|
|
|
|
}
|
|
|
|
|
|
|
|
var All = []Interface{
|
|
|
|
&RunStage{}, // Shells out to stages defined from the container image
|
|
|
|
&GrubOptions{}, // Set custom GRUB options
|
2022-10-02 22:16:01 +00:00
|
|
|
&BundleOption{},
|
2022-10-07 11:36:32 +00:00
|
|
|
&Kcrypt{},
|
2022-10-02 22:16:01 +00:00
|
|
|
&Lifecycle{}, // Handles poweroff/reboot by config options
|
2022-09-08 13:39:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func Run(c config.Config, hooks ...Interface) error {
|
|
|
|
for _, h := range hooks {
|
|
|
|
if err := h.Run(c); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|