Merge pull request #1580 from thebsdbox/vmware_fix

Added Linux $PATH support and fixed FlagSet typo
This commit is contained in:
Justin Cormack 2017-04-11 12:09:38 +01:00 committed by GitHub
commit 91f00edc55

View File

@ -58,7 +58,7 @@ guestOS = "other3xlinux-64"
`
func runVMware(args []string) {
vmwareArgs := flag.NewFlagSet("hyperkit", flag.ExitOnError)
vmwareArgs := flag.NewFlagSet("vmware", flag.ExitOnError)
vmwareArgs.Usage = func() {
fmt.Printf("USAGE: %s run vmware [options] prefix\n\n", os.Args[0])
fmt.Printf("'prefix' specifies the path to the VM image.\n")
@ -102,6 +102,16 @@ func runVMware(args []string) {
vmrunArgs = []string{"-T", "fusion", "start", prefix + ".vmx"}
}
if runtime.GOOS == "linux" {
path = "vmrun"
fullVMrunPath, err := exec.LookPath(path)
if err != nil {
log.Fatalf("Unable to find %s within the $PATH", path)
}
path = fullVMrunPath
vmrunArgs = []string{"-T", "ws", "start", prefix + ".vmx"}
}
// Check executables exist before attempting to execute
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Fatalf("ERROR VMware exectuables can not be found, ensure software is installed")