From 5317d28919aef708c090bb4c4b160caccfbdf6fe Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> Date: Thu, 31 Mar 2022 18:07:22 +0200 Subject: [PATCH] service: configure reboot delay quirk If the boot protocol supports the reboot delay API then the configured reboot quirk is respected and applied to the boot protocol instance. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> --- cmd/sysotad/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/sysotad/service.go b/cmd/sysotad/service.go index 2c68529..7fddb1f 100644 --- a/cmd/sysotad/service.go +++ b/cmd/sysotad/service.go @@ -5,6 +5,7 @@ package sysotad import ( "fmt" + "time" "github.com/godbus/dbus/v5" "gitlab.com/zygoon/go-raspi/pimodel" @@ -143,6 +144,11 @@ func NewService(conn *dbus.Conn, opts ...Option) (*Service, error) { return nil, err } + // Ask the boot protocol to delay the reboot process if this is supported. + if delayer, ok := bootProto.(boot.RebootDelayer); ok { + delayer.SetRebootDelay(time.Duration(svc.confGuard.Config().QuirkRebootDelay) * time.Second) + } + // Configure and add the boot service if the corresponding // debug flag is enabled. if svc.confGuard.Config().DebugBootAPI { -- GitLab