Commit dca27957 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/vmware: Generate more correct VMX file

parent 05a34d2f
package vmware
import (
"github.com/mitchellh/mapstructure"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
......@@ -14,11 +15,17 @@ type Builder struct {
type config struct {
DiskName string `mapstructure:"vmdk_name"`
ISOUrl string `mapstructure:"iso_url"`
VMName string `mapstructure:"vm_name"`
OutputDir string `mapstructure:"output_directory"`
}
func (b *Builder) Prepare(raw interface{}) (err error) {
err = mapstructure.Decode(raw, &b.config)
if err != nil {
return
}
if b.config.DiskName == "" {
b.config.DiskName = "disk"
}
......
......@@ -13,6 +13,7 @@ type vmxTemplateData struct {
Name string
GuestOS string
DiskName string
ISOPath string
}
type stepCreateVMX struct{}
......@@ -32,6 +33,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
config.VMName,
"ubuntu-64",
config.DiskName,
config.ISOUrl,
}
t := template.Must(template.New("vmx").Parse(DefaultVMXTemplate))
......@@ -71,6 +73,9 @@ gui.fullScreenAtPowerOn = "FALSE"
gui.viewModeAtPowerOn = "windowed"
hgfs.linkRootShare = "TRUE"
hgfs.mapRootShare = "TRUE"
ide1:0.present = "TRUE"
ide1:0.fileName = "{{ .ISOPath }}"
ide1:0.deviceType = "cdrom-image"
isolation.tools.hgfs.disable = "FALSE"
memsize = "512"
nvram = "{{ .Name }}.nvram"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment