mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-19 00:52:36 +00:00
sparkles: Add kcrypt to images (#195)
* ✨ Add kcrypt to images This adds the dracut module and the binary to the images. Related to https://github.com/kairos-io/kairos/issues/184 * ✨ Add Kcrypt post-install hook Fixes https://github.com/kairos-io/kairos/issues/184
This commit is contained in:
committed by
Itxaka
parent
a8875f6b4f
commit
78bcb65cb6
@@ -12,6 +12,7 @@ var All = []Interface{
|
||||
&RunStage{}, // Shells out to stages defined from the container image
|
||||
&GrubOptions{}, // Set custom GRUB options
|
||||
&BundleOption{},
|
||||
&Kcrypt{},
|
||||
&Lifecycle{}, // Handles poweroff/reboot by config options
|
||||
}
|
||||
|
||||
|
28
internal/agent/hooks/kcrypt.go
Normal file
28
internal/agent/hooks/kcrypt.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
config "github.com/kairos-io/kairos/pkg/config"
|
||||
"github.com/kairos-io/kairos/pkg/utils"
|
||||
)
|
||||
|
||||
type Kcrypt struct{}
|
||||
|
||||
func (k Kcrypt) Run(c config.Config) error {
|
||||
for _, p := range c.Install.Encrypt {
|
||||
out, err := utils.SH(fmt.Sprintf("kcrypt encrypt %s", p))
|
||||
if err != nil {
|
||||
fmt.Printf("could not encrypt partition: %s\n", out+err.Error())
|
||||
if c.FailOnBundleErrors {
|
||||
return err
|
||||
}
|
||||
// Give time to show the error
|
||||
time.Sleep(10 * time.Second)
|
||||
return nil // do not error out
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user