Files
podman/pkg/machine/machine_unix.go
Jason T. Greene 487219d809 Complete WSL implementation, refactor a few areas
Also addresses a number of issues:
- StopHostNetworking isn't plumbed, win-sshproxy leaks on hyperv
- Wait api and print output doesn't work properly on Windows
- API forwarding doesn't work on WSL
- Terminal corruption with after start/stop on Windows
- Gvproxy is forcefully killed vs gracefully quit
- Switching rootful/rootless does not update /var/run/docker.sock on the guest
- File already closed error on init
- HyperV backend is publishing Unix sockets when it should be named pipes
- User-mode networking doesn't always work
- Stop state outside of lock boundaries
- WSL blocks parallel machined (should be supported)

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-11 12:58:11 -06:00

46 lines
1.0 KiB
Go

//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
package machine
import (
"context"
"errors"
"fmt"
"net"
"strings"
)
// ParseVolumeFromPath is a oneshot parsing of a provided volume. It follows the "rules" of
// the singular parsing functions
func ParseVolumeFromPath(v string) (source, target, options string, readonly bool, err error) {
split := strings.SplitN(v, ":", 3)
switch len(split) {
case 1:
source = split[0]
target = split[0]
case 2:
source = split[0]
target = split[1]
case 3:
source = split[0]
target = split[1]
options = split[2]
default:
return "", "", "", false, errors.New("invalid volume provided")
}
// I suppose an option not intended for read-only could interfere here but I do not see a better way
if strings.Contains(options, "ro") {
readonly = true
}
return
}
func DialNamedPipe(ctx context.Context, path string) (net.Conn, error) {
return nil, errors.New("not implemented")
}
func GetEnvSetString(env string, val string) string {
return fmt.Sprintf("export %s='%s'", env, val)
}