Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
8fecdf17
Commit
8fecdf17
authored
Dec 26, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware/common: Fusion6Driver
parent
f23d66a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
builder/vmware/common/driver.go
builder/vmware/common/driver.go
+6
-0
builder/vmware/common/driver_fusion6.go
builder/vmware/common/driver_fusion6.go
+60
-0
No files found.
builder/vmware/common/driver.go
View file @
8fecdf17
...
...
@@ -62,6 +62,12 @@ func NewDriver(config *SSHConfig) (Driver, error) {
switch
runtime
.
GOOS
{
case
"darwin"
:
drivers
=
[]
Driver
{
&
Fusion6Driver
{
Fusion5Driver
:
Fusion5Driver
{
AppPath
:
"/Applications/VMware Fusion.app"
,
SSHConfig
:
config
,
},
},
&
Fusion5Driver
{
AppPath
:
"/Applications/VMware Fusion.app"
,
SSHConfig
:
config
,
...
...
builder/vmware/common/driver_fusion6.go
0 → 100644
View file @
8fecdf17
package
common
import
(
"bytes"
"errors"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
// Fusion6Driver is a driver that can run VMWare Fusion 5.
type
Fusion6Driver
struct
{
Fusion5Driver
}
func
(
d
*
Fusion6Driver
)
Clone
(
dst
,
src
string
)
error
{
return
errors
.
New
(
"Cloning is not supported with Fusion 5. Please use Fusion 6+."
)
}
func
(
d
*
Fusion6Driver
)
Verify
()
error
{
if
err
:=
d
.
Fusion5Driver
.
Verify
();
err
!=
nil
{
return
err
}
vmxpath
:=
filepath
.
Join
(
d
.
AppPath
,
"Contents"
,
"Library"
,
"vmware-vmx"
)
if
_
,
err
:=
os
.
Stat
(
vmxpath
);
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
return
fmt
.
Errorf
(
"vmware-vmx could not be found at path: %s"
,
vmxpath
)
}
return
err
}
var
stderr
bytes
.
Buffer
cmd
:=
exec
.
Command
(
vmxpath
,
"-v"
)
cmd
.
Stderr
=
&
stderr
if
err
:=
cmd
.
Run
();
err
!=
nil
{
return
err
}
versionRe
:=
regexp
.
MustCompile
(
`(?i)VMware [a-z0-9-]+ (\d+\.\d+\.\d+)\s`
)
matches
:=
versionRe
.
FindStringSubmatch
(
stderr
.
String
())
if
matches
==
nil
{
return
fmt
.
Errorf
(
"Couldn't find VMware version in output: %s"
,
stderr
.
String
())
}
log
.
Printf
(
"Detected VMware version: %s"
,
matches
[
1
])
if
!
strings
.
HasPrefix
(
matches
[
1
],
"6."
)
{
return
fmt
.
Errorf
(
"Fusion 6 not detected. Got version: %s"
,
matches
[
1
])
}
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment