builder/vmware: Generate more correct VMX file
This commit is contained in:
parent
05a34d2fb1
commit
dca2795751
@ -1,6 +1,7 @@
|
|||||||
package vmware
|
package vmware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
)
|
)
|
||||||
@ -14,11 +15,17 @@ type Builder struct {
|
|||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
DiskName string `mapstructure:"vmdk_name"`
|
DiskName string `mapstructure:"vmdk_name"`
|
||||||
|
ISOUrl string `mapstructure:"iso_url"`
|
||||||
VMName string `mapstructure:"vm_name"`
|
VMName string `mapstructure:"vm_name"`
|
||||||
OutputDir string `mapstructure:"output_directory"`
|
OutputDir string `mapstructure:"output_directory"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Prepare(raw interface{}) (err error) {
|
func (b *Builder) Prepare(raw interface{}) (err error) {
|
||||||
|
err = mapstructure.Decode(raw, &b.config)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.DiskName == "" {
|
if b.config.DiskName == "" {
|
||||||
b.config.DiskName = "disk"
|
b.config.DiskName = "disk"
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ type vmxTemplateData struct {
|
|||||||
Name string
|
Name string
|
||||||
GuestOS string
|
GuestOS string
|
||||||
DiskName string
|
DiskName string
|
||||||
|
ISOPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type stepCreateVMX struct{}
|
type stepCreateVMX struct{}
|
||||||
@ -32,6 +33,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
|
|||||||
config.VMName,
|
config.VMName,
|
||||||
"ubuntu-64",
|
"ubuntu-64",
|
||||||
config.DiskName,
|
config.DiskName,
|
||||||
|
config.ISOUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
t := template.Must(template.New("vmx").Parse(DefaultVMXTemplate))
|
t := template.Must(template.New("vmx").Parse(DefaultVMXTemplate))
|
||||||
@ -71,6 +73,9 @@ gui.fullScreenAtPowerOn = "FALSE"
|
|||||||
gui.viewModeAtPowerOn = "windowed"
|
gui.viewModeAtPowerOn = "windowed"
|
||||||
hgfs.linkRootShare = "TRUE"
|
hgfs.linkRootShare = "TRUE"
|
||||||
hgfs.mapRootShare = "TRUE"
|
hgfs.mapRootShare = "TRUE"
|
||||||
|
ide1:0.present = "TRUE"
|
||||||
|
ide1:0.fileName = "{{ .ISOPath }}"
|
||||||
|
ide1:0.deviceType = "cdrom-image"
|
||||||
isolation.tools.hgfs.disable = "FALSE"
|
isolation.tools.hgfs.disable = "FALSE"
|
||||||
memsize = "512"
|
memsize = "512"
|
||||||
nvram = "{{ .Name }}.nvram"
|
nvram = "{{ .Name }}.nvram"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user