mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-24 19:57:24 +00:00
Rework reboot/shutdown to use the hooks (#96)
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"github.com/kairos-io/kairos-sdk/utils"
|
||||
"github.com/kairos-io/kairos-agent/v2/pkg/config"
|
||||
v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1"
|
||||
"github.com/kairos-io/kairos-sdk/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Lifecycle struct{}
|
||||
|
||||
func (s Lifecycle) Run(c config.Config) error {
|
||||
if c.Install.Reboot {
|
||||
func (s Lifecycle) Run(c config.Config, spec v1.Spec) error {
|
||||
if spec.ShouldReboot() {
|
||||
time.Sleep(5)
|
||||
utils.Reboot()
|
||||
}
|
||||
|
||||
if c.Install.Poweroff {
|
||||
if spec.ShouldShutdown() {
|
||||
time.Sleep(5)
|
||||
utils.PowerOFF()
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user