Allow opening LUKS containers inside linsk ls
This commit is contained in:
parent
02d3bd1aee
commit
0fea76d273
4 changed files with 135 additions and 52 deletions
14
cmd/ls.go
14
cmd/ls.go
|
|
@ -32,7 +32,17 @@ var lsCmd = &cobra.Command{
|
|||
Short: "Start a VM and list all user drives within the VM. Uses lsblk command under the hood.",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
configureVMRuntimeFlags()
|
||||
|
||||
os.Exit(runVM(args[0], func(ctx context.Context, i *vm.VM, fm *vm.FileManager, trc *share.NetTapRuntimeContext) int {
|
||||
if vmRuntimeLUKSContainerDevice != "" {
|
||||
err := fm.PreopenLUKSContainer(vmRuntimeLUKSContainerDevice)
|
||||
if err != nil {
|
||||
slog.Error("Failed to preopen LUKS container", "error", err.Error())
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
lsblkOut, err := fm.Lsblk()
|
||||
if err != nil {
|
||||
slog.Error("Failed to list block devices in the VM", "error", err.Error())
|
||||
|
|
@ -49,3 +59,7 @@ var lsCmd = &cobra.Command{
|
|||
}, nil, false, false))
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
initVMRuntimeFlags(lsCmd.Flags())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue