Fixes recovery

- Add isRecovery to state
 - Get the TargetImage from cmdline
 - Add isrecovery to conditions

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
This commit is contained in:
Itxaka
2023-02-08 18:51:53 +01:00
parent 441c4d17a3
commit 99cd455ce8
3 changed files with 13 additions and 13 deletions

View File

@@ -32,20 +32,16 @@ func BootStateToLabel() string {
}
}
func BootStateToImage() string {
func IsRecovery() bool {
runtime, err := state.NewRuntime()
if err != nil {
return ""
return false
}
switch runtime.BootState {
case "active_boot":
return "/cOS/active.img"
case "passive_boot":
return "/cOS/passive.img"
case "recovery_boot":
return "/cOS/recovery.img"
return true
default:
return ""
return false
}
}