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
67920da4
Commit
67920da4
authored
Jul 02, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #108 from smerrill/headless-mode
builder/vmware, builder/virtualbox: Headless mode
parents
c7c22bee
2aeb756a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
5 deletions
+16
-5
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+1
-0
builder/virtualbox/step_run.go
builder/virtualbox/step_run.go
+5
-1
builder/vmware/builder.go
builder/vmware/builder.go
+1
-0
builder/vmware/driver.go
builder/vmware/driver.go
+8
-3
builder/vmware/step_run.go
builder/vmware/step_run.go
+1
-1
No files found.
builder/virtualbox/builder.go
View file @
67920da4
...
...
@@ -30,6 +30,7 @@ type config struct {
DiskSize
uint
`mapstructure:"disk_size"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
...
...
builder/virtualbox/step_run.go
View file @
67920da4
...
...
@@ -23,7 +23,11 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
vmName
:=
state
[
"vmName"
]
.
(
string
)
ui
.
Say
(
"Starting the virtual machine..."
)
command
:=
[]
string
{
"startvm"
,
vmName
,
"--type"
,
"gui"
}
guiArgument
:=
"gui"
if
config
.
Headless
==
true
{
guiArgument
=
"headless"
}
command
:=
[]
string
{
"startvm"
,
vmName
,
"--type"
,
guiArgument
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error starting VM: %s"
,
err
)
state
[
"error"
]
=
err
...
...
builder/vmware/builder.go
View file @
67920da4
...
...
@@ -33,6 +33,7 @@ type config struct {
ISOUrl
string
`mapstructure:"iso_url"`
VMName
string
`mapstructure:"vm_name"`
OutputDir
string
`mapstructure:"output_directory"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
...
...
builder/vmware/driver.go
View file @
67920da4
...
...
@@ -22,7 +22,7 @@ type Driver interface {
IsRunning
(
string
)
(
bool
,
error
)
// Start starts a VM specified by the path to the VMX given.
Start
(
string
)
error
Start
(
string
,
bool
)
error
// Stop stops a VM specified by the path to the VMX given.
Stop
(
string
)
error
...
...
@@ -87,8 +87,13 @@ func (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error) {
return
false
,
nil
}
func
(
d
*
Fusion5Driver
)
Start
(
vmxPath
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
vmrunPath
(),
"-T"
,
"fusion"
,
"start"
,
vmxPath
,
"gui"
)
func
(
d
*
Fusion5Driver
)
Start
(
vmxPath
string
,
headless
bool
)
error
{
guiArgument
:=
"gui"
if
headless
==
true
{
guiArgument
=
"nogui"
}
cmd
:=
exec
.
Command
(
d
.
vmrunPath
(),
"-T"
,
"fusion"
,
"start"
,
vmxPath
,
guiArgument
)
if
_
,
_
,
err
:=
d
.
runAndLog
(
cmd
);
err
!=
nil
{
return
err
}
...
...
builder/vmware/step_run.go
View file @
67920da4
...
...
@@ -33,7 +33,7 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
s
.
vmxPath
=
vmxPath
ui
.
Say
(
"Starting virtual machine..."
)
if
err
:=
driver
.
Start
(
vmxPath
);
err
!=
nil
{
if
err
:=
driver
.
Start
(
vmxPath
,
config
.
Headless
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error starting VM: %s"
,
err
)
state
[
"error"
]
=
err
ui
.
Error
(
err
.
Error
())
...
...
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