From a8b86582455d9d772f27ac6f3c4e61b3c3986989 Mon Sep 17 00:00:00 2001 From: Konstantinos Koukopoulos Date: Thu, 9 Oct 2014 11:45:03 +0300 Subject: [PATCH] figure out VirtualBox version on FreeBSD --- builder/virtualbox/common/driver_4_2.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builder/virtualbox/common/driver_4_2.go b/builder/virtualbox/common/driver_4_2.go index f77b29a57..58a708cf3 100644 --- a/builder/virtualbox/common/driver_4_2.go +++ b/builder/virtualbox/common/driver_4_2.go @@ -195,12 +195,12 @@ func (d *VBox42Driver) Version() (string, error) { return "", fmt.Errorf("VirtualBox is not properly setup: %s", versionOutput) } - versionRe := regexp.MustCompile("^[.0-9]+(?:_RC[0-9]+)?") - matches := versionRe.FindAllString(versionOutput, 1) - if matches == nil { + versionRe := regexp.MustCompile("^([.0-9]+)(?:_(?:RC|OSEr)[0-9]+)?") + matches := versionRe.FindAllStringSubmatch(versionOutput, 1) + if matches == nil || len(matches[0]) != 2 { return "", fmt.Errorf("No version found: %s", versionOutput) } - log.Printf("VirtualBox version: %s", matches[0]) - return matches[0], nil + log.Printf("VirtualBox version: %s", matches[0][1]) + return matches[0][1], nil }