Add shim to choose next entry to boot from (#230)

This commit is contained in:
Itxaka
2024-02-21 10:44:32 +01:00
committed by GitHub
parent cce432133e
commit 2e9c85e63a
13 changed files with 775 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ package uki
import (
"fmt"
"github.com/kairos-io/kairos-agent/v2/pkg/action"
"github.com/kairos-io/kairos-agent/v2/pkg/config"
"github.com/kairos-io/kairos-agent/v2/pkg/constants"
"github.com/kairos-io/kairos-agent/v2/pkg/elemental"
@@ -70,6 +71,12 @@ func (r *ResetAction) Run() (err error) {
if err != nil {
return fmt.Errorf("copying recovery to active: %w", err)
}
// SelectBootEntry sets the default boot entry to the selected entry
err = action.SelectBootEntry(r.cfg, "active")
// Should we fail? Or warn?
if err != nil {
return err
}
_ = elementalUtils.RunStage(r.cfg, "kairos-uki-reset.after")
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.reset.after.hook") //nolint:errcheck