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
9a622691
Commit
9a622691
authored
Feb 24, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #900 from pmyjavec/ws10-linux-driver
VMWare Workstation 10 driver for Linux
parents
adee47a7
3ea4aa1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletion
+74
-1
builder/vmware/common/driver.go
builder/vmware/common/driver.go
+5
-0
builder/vmware/common/driver_workstation10.go
builder/vmware/common/driver_workstation10.go
+68
-0
builder/vmware/common/driver_workstation_unix.go
builder/vmware/common/driver_workstation_unix.go
+1
-1
No files found.
builder/vmware/common/driver.go
View file @
9a622691
...
@@ -75,6 +75,11 @@ func NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error) {
...
@@ -75,6 +75,11 @@ func NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error) {
}
}
case
"linux"
:
case
"linux"
:
drivers
=
[]
Driver
{
drivers
=
[]
Driver
{
&
Workstation10Driver
{
Workstation9Driver
:
Workstation9Driver
{
SSHConfig
:
config
,
},
},
&
Workstation9Driver
{
&
Workstation9Driver
{
SSHConfig
:
config
,
SSHConfig
:
config
,
},
},
...
...
builder/vmware/common/driver_workstation10.go
0 → 100644
View file @
9a622691
package
common
import
(
"os/exec"
"bytes"
"regexp"
"fmt"
"log"
"strings"
"runtime"
)
// Workstation10Driver is a driver that can run VMware Workstation 10
// installations. Current only tested for UNIX
type
Workstation10Driver
struct
{
Workstation9Driver
}
func
(
d
*
Workstation10Driver
)
Clone
(
dst
,
src
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
Workstation9Driver
.
VmrunPath
,
"-T"
,
"ws"
,
"clone"
,
src
,
dst
,
"full"
)
if
_
,
_
,
err
:=
runAndLog
(
cmd
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
d
*
Workstation10Driver
)
Verify
()
error
{
if
runtime
.
GOOS
!=
"linux"
{
return
fmt
.
Errorf
(
"can't used driver WS 10 not yet supported on: %s"
,
runtime
.
GOOS
)
}
if
err
:=
d
.
Workstation9Driver
.
Verify
();
err
!=
nil
{
return
err
}
//TODO(pmyjavec) there is a better way to find this, how?
//the default will suffice for now.
vmxpath
:=
"/usr/lib/vmware/bin/vmware-vmx"
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 Workstation (\d+\.\d+\.\d+)\s`
)
matches
:=
versionRe
.
FindStringSubmatch
(
stderr
.
String
())
if
matches
==
nil
{
return
fmt
.
Errorf
(
"Couldn't find VMware WS version in output: %s"
,
stderr
.
String
())
}
log
.
Printf
(
"Detected VMware WS version: %s"
,
matches
[
1
])
if
!
strings
.
HasPrefix
(
matches
[
1
],
"10."
)
{
return
fmt
.
Errorf
(
"WS 10 not detected. Got version: %s"
,
matches
[
1
])
}
return
nil
}
builder/vmware/common/driver_workstation
9
_unix.go
→
builder/vmware/common/driver_workstation_unix.go
View file @
9a622691
// +build !windows
// +build !windows
// These functions are compatible with WS 9 and 10 on *NIX
package
common
package
common
import
(
import
(
...
...
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