2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2025-07-05 11:02:26 +00:00

run/qemu: remove usb and device flags

refactor: move qemu to its own package
tests: implements end to end tests for the convert command with the following images: alpine:3.17, ubuntu:20.04, debian:11, centos:8

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2023-02-23 11:37:40 +01:00
parent 532ee3f1a3
commit 8505dbd02a
12 changed files with 761 additions and 365 deletions

View File

@ -130,7 +130,14 @@ func RunD2VM(ctx context.Context, image, version, in, out, cmd string, args ...s
if version == "" {
version = "latest"
}
a := []string{
a := []string{"run", "--rm"}
interactive := isInteractive()
if interactive {
a = append(a, "-i", "-t")
}
a = append(a,
"--privileged",
"-e",
// yes... it is kind of a dirty hack
@ -145,6 +152,12 @@ func RunD2VM(ctx context.Context, image, version, in, out, cmd string, args ...s
"/d2vm",
fmt.Sprintf("%s:%s", image, version),
cmd,
)
c := exec.CommandContext(ctx, "docker", append(a, args...)...)
if interactive {
c.Stdin = os.Stdin
}
return RunInteractiveAndRemove(ctx, append(a, args...)...)
c.Stdout = os.Stdout
c.Stderr = os.Stderr
return c.Run()
}