mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 11:12:30 +00:00
Adapt to kcrypt bump
Basically create a fake KairosLogger to pass to kcrypt Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
parent
a597656fe0
commit
b819f9fb5d
2
go.mod
2
go.mod
@ -12,7 +12,7 @@ require (
|
||||
github.com/jaypipes/ghw v0.13.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/kairos-io/kairos-sdk v0.6.1
|
||||
github.com/kairos-io/kcrypt v0.12.2
|
||||
github.com/kairos-io/kcrypt v0.13.0
|
||||
github.com/moby/sys/mountinfo v0.7.2
|
||||
github.com/mudler/go-kdetect v0.0.0-20210802130128-dd92e121bed8
|
||||
github.com/mudler/yip v1.15.0
|
||||
|
2
go.sum
2
go.sum
@ -392,6 +392,8 @@ github.com/kairos-io/kairos-sdk v0.6.1 h1:DplbiHgWjg7W8zzeB5TQPFBthfF3UQxJlcLZqv
|
||||
github.com/kairos-io/kairos-sdk v0.6.1/go.mod h1:MT/0k20U1BcN8AzzQUexpfrQ8XCC6jIPDG9ZAmx+I2c=
|
||||
github.com/kairos-io/kcrypt v0.12.2 h1:+lr8FGS0AW6D5dWSmaR3+AobL1TBTnOFgCSYctKY+5I=
|
||||
github.com/kairos-io/kcrypt v0.12.2/go.mod h1:7SPiHzNMYl4MlxeB30s1YlHDYByTusu7u1mU5Nvicm0=
|
||||
github.com/kairos-io/kcrypt v0.13.0 h1:Gmoe8MbkKV6ux5/aZQCsjxYZM9kbgXz8eoK1NqDLxDk=
|
||||
github.com/kairos-io/kcrypt v0.13.0/go.mod h1:C8dHeMJPXkmum6W2hn4sRJNLs7HxGK84QsVOBcwSWU0=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kendru/darwin/go/depgraph v0.0.0-20221105232959-877d6a81060c h1:eKb4PqwAMhlqwXw0W3atpKaYaPGlXE/Fwh+xpCEYaPk=
|
||||
|
@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/kairos-io/kairos-sdk/types"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -14,6 +15,9 @@ import (
|
||||
var Log zerolog.Logger
|
||||
var logFile *os.File
|
||||
|
||||
// KLog is the generic KairosLogger that we pass to kcrypt calls
|
||||
var KLog types.KairosLogger
|
||||
|
||||
func CloseLogFiles() {
|
||||
logFile.Close()
|
||||
}
|
||||
@ -41,6 +45,8 @@ func SetLogger() {
|
||||
level = zerolog.DebugLevel
|
||||
}
|
||||
Log = zerolog.New(multi).With().Timestamp().Logger().Level(level)
|
||||
KLog = types.NewNullLogger()
|
||||
KLog.Logger = Log
|
||||
}
|
||||
|
||||
// MiddleLog implements the bridge between zerolog and the logger.Interface that yip needs.
|
||||
|
@ -172,7 +172,7 @@ func (s *State) LVMActivation(g *herd.Graph) error {
|
||||
func (s *State) RunKcrypt(g *herd.Graph, opts ...herd.OpOption) error {
|
||||
return g.Add(cnst.OpKcryptUnlock, append(opts, herd.WithCallback(func(_ context.Context) error {
|
||||
internalUtils.Log.Debug().Msg("Unlocking with kcrypt")
|
||||
return kcrypt.UnlockAllWithLogger(false, internalUtils.Log)
|
||||
return kcrypt.UnlockAllWithLogger(false, internalUtils.KLog)
|
||||
}))...)
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ func (s *State) UKIUnlock(g *herd.Graph, opts ...herd.OpOption) error {
|
||||
}
|
||||
_ = os.Setenv("PATH", "/usr/bin:/usr/sbin:/bin:/sbin")
|
||||
internalUtils.Log.Debug().Msg("Will now try to unlock partitions")
|
||||
err := kcrypt.UnlockAllWithLogger(true, internalUtils.Log)
|
||||
err := kcrypt.UnlockAllWithLogger(true, internalUtils.KLog)
|
||||
if err != nil {
|
||||
internalUtils.RebootOrWait("Unlocking partitions failed", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user