Merge pull request #3673 from rickard-von-essen/prl-support-future-ver

Support future versions of Parallels by using the latest driver
This commit is contained in:
Rickard von Essen 2016-07-06 22:58:01 +02:00 committed by GitHub
commit cd0620d1f8
1 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"log"
"os/exec"
"runtime"
"strconv"
"strings"
)
@ -125,6 +126,14 @@ func NewDriver() (Driver, error) {
supportedVersions = append(supportedVersions, v)
}
latestDriver := 11
version, _ := drivers[strconv.Itoa(latestDriver)].Version()
majVer, _ := strconv.Atoi(strings.SplitN(version, ".", 2)[0])
if majVer > latestDriver {
log.Printf("Your version of Parallels Desktop for Mac is %s, Packer will use driver for version %d.", version, latestDriver)
return drivers[strconv.Itoa(latestDriver)], nil
}
return nil, fmt.Errorf(
"Unable to initialize any driver. Supported Parallels Desktop versions: "+
"%s\n", strings.Join(supportedVersions, ", "))