Exit properly if we cannot unlock partitions (#334)

This commit is contained in:
Itxaka 2024-06-11 16:51:33 +02:00 committed by GitHub
parent d309c92573
commit 4c4801cde3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -394,7 +394,15 @@ func (s *State) UKIUnlock(g *herd.Graph, opts ...herd.OpOption) error {
} }
_ = os.Setenv("PATH", "/usr/bin:/usr/sbin:/bin:/sbin") _ = os.Setenv("PATH", "/usr/bin:/usr/sbin:/bin:/sbin")
internalUtils.Log.Debug().Msg("Will now try to unlock partitions") internalUtils.Log.Debug().Msg("Will now try to unlock partitions")
return kcrypt.UnlockAllWithLogger(true, internalUtils.Log) err := kcrypt.UnlockAllWithLogger(true, internalUtils.Log)
if err != nil {
internalUtils.Log.Info().Msg(s.WriteDAG(g))
internalUtils.Log.Err(err).Msg("Unlocking partitions")
internalUtils.Log.Warn().Msg("Unlocking partitions failed, waiting 10 seconds and rebooting")
time.Sleep(10 * time.Second)
return syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
}
return nil
}))...) }))...)
} }