builder/virtualbox: search VBOX_MSI_INSTALL_PATH [GH-1337]
This commit is contained in:
parent
f0bc4fd0b7
commit
c0f9dbde41
|
@ -33,6 +33,8 @@ BUG FIXES:
|
|||
* builder/parallels/all: Added some navigation keys [GH-1442]
|
||||
* builder/qemu: If headless, sdl display won't be used. [GH-1395]
|
||||
* builder/qemu: Use `512M` as `-m` default. [GH-1444]
|
||||
* builder/virtualbox/all: Search `VBOX_MSI_INSTALL_PATH` for path to
|
||||
`VBoxManage` on Windows. [GH-1337]
|
||||
* builder/virtualbox/all: Seed RNG to avoid same ports. [GH-1386]
|
||||
* builder/virtualbox/all: Better error if guest additions URL couldn't be
|
||||
detected. [GH-1439]
|
||||
|
|
|
@ -55,15 +55,16 @@ func NewDriver() (Driver, error) {
|
|||
|
||||
// On Windows, we check VBOX_INSTALL_PATH env var for the path
|
||||
if runtime.GOOS == "windows" {
|
||||
if installPath := os.Getenv("VBOX_INSTALL_PATH"); installPath != "" {
|
||||
log.Printf("[DEBUG] builder/virtualbox: VBOX_INSTALL_PATH: %s",
|
||||
installPath)
|
||||
for _, path := range strings.Split(installPath, ";") {
|
||||
path = filepath.Join(path, "VBoxManage.exe")
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
vboxmanagePath = path
|
||||
break
|
||||
}
|
||||
vars := []string{"VBOX_INSTALL_PATH", "VBOX_MSI_INSTALL_PATH"}
|
||||
for _, key := range vars {
|
||||
value := os.Getenv(key)
|
||||
if value != "" {
|
||||
log.Printf(
|
||||
"[DEBUG] builder/virtualbox: %s = %s", key, value)
|
||||
vboxmanagePath = findVBoxManageWindows(value)
|
||||
}
|
||||
if vboxmanagePath != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,3 +85,14 @@ func NewDriver() (Driver, error) {
|
|||
|
||||
return driver, nil
|
||||
}
|
||||
|
||||
func findVBoxManageWindows(paths string) string {
|
||||
for _, path := range strings.Split(paths, ";") {
|
||||
path = filepath.Join(path, "VBoxManage.exe")
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue