builder/vmware: Generate more correct VMX file
This commit is contained in:
parent
05a34d2fb1
commit
dca2795751
|
@ -1,6 +1,7 @@
|
|||
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"
|
||||
|
|
Loading…
Reference in New Issue