LUKS support + other things

This commit is contained in:
AlexSSD7 2023-08-25 19:55:11 +01:00
commit 4369fb82dd
8 changed files with 201 additions and 22 deletions

View file

@ -18,8 +18,13 @@ var runCmd = &cobra.Command{
vmMountDevName := args[1]
fsType := args[2]
// TODO: `slog` library prints entire stack traces for errors which makes reading errors challenging.
runVM(args[0], func(ctx context.Context, i *vm.Instance, fm *vm.FileManager) {
err := fm.Mount(vmMountDevName, vm.MountOptions{FSType: fsType})
err := fm.Mount(vmMountDevName, vm.MountOptions{
FSType: fsType,
LUKS: luksFlag,
})
if err != nil {
slog.Error("Failed to mount the disk inside the VM", "error", err)
return
@ -32,3 +37,9 @@ var runCmd = &cobra.Command{
return nil
},
}
var luksFlag bool
func init() {
runCmd.Flags().BoolVarP(&luksFlag, "luks", "l", false, "Use cryptsetup to open a LUKS volume (password will be prompted)")
}