mirror of
https://github.com/linka-cloud/d2vm.git
synced 2025-06-23 13:52:26 +00:00
set user permissions on image if run with sudo or in docker run/vbox & run/hetzner: run qemu-img in docker if not available in path Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@ -97,7 +97,6 @@ func Pull(ctx context.Context, tag string) error {
|
||||
}
|
||||
|
||||
func RunInteractiveAndRemove(ctx context.Context, args ...string) error {
|
||||
logrus.Tracef("running 'docker run --rm -i -t %s'", strings.Join(args, " "))
|
||||
cmd := exec.CommandContext(ctx, "docker", append([]string{"run", "--rm", "-it"}, args...)...)
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
@ -129,6 +128,9 @@ func RunD2VM(ctx context.Context, image, version, in, out, cmd string, args ...s
|
||||
}
|
||||
a := []string{
|
||||
"--privileged",
|
||||
"-e",
|
||||
// yes... it is kind of a dirty hack
|
||||
fmt.Sprintf("SUDO_UID=%d", os.Getuid()),
|
||||
"-v",
|
||||
fmt.Sprintf("%s:/var/run/docker.sock", dockerSocket()),
|
||||
"-v",
|
||||
|
@ -26,8 +26,6 @@ import (
|
||||
|
||||
var (
|
||||
Run = RunNoOut
|
||||
|
||||
CommandContext = exec.CommandContext
|
||||
)
|
||||
|
||||
func SetDebug(debug bool) {
|
||||
@ -39,6 +37,11 @@ func SetDebug(debug bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func CommandContext(ctx context.Context, c string, args ...string) *exec.Cmd {
|
||||
logrus.Debugf("$ %s %s", c, strings.Join(args, " "))
|
||||
return exec.CommandContext(ctx, c, args...)
|
||||
}
|
||||
|
||||
func RunDebug(ctx context.Context, c string, args ...string) error {
|
||||
logrus.Debugf("$ %s %s", c, strings.Join(args, " "))
|
||||
cmd := exec.CommandContext(ctx, c, args...)
|
||||
|
Reference in New Issue
Block a user