2019-05-31 08:27:41 -04:00
|
|
|
//go:generate struct-markdown
|
|
|
|
|
2013-12-22 12:24:29 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/template/interpolate"
|
2013-12-22 12:24:29 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type VBoxManageConfig struct {
|
2019-06-19 11:07:23 -04:00
|
|
|
// Custom `VBoxManage` commands to execute in order to further customize
|
|
|
|
// the virtual machine being created. The value of this is an array of
|
|
|
|
// commands to execute. The commands are executed in the order defined in
|
|
|
|
// the template. For each command, the command is defined itself as an
|
|
|
|
// array of strings, where each string represents a single argument on the
|
|
|
|
// command-line to `VBoxManage` (but excluding `VBoxManage` itself). Each
|
|
|
|
// arg is treated as a [configuration
|
2020-04-01 18:54:21 -04:00
|
|
|
// template](/docs/templates/engine), where the `Name` variable is
|
2019-06-19 11:07:23 -04:00
|
|
|
// replaced with the VM name. More details on how to use `VBoxManage` are
|
|
|
|
// below.
|
2019-05-28 11:50:58 -04:00
|
|
|
VBoxManage [][]string `mapstructure:"vboxmanage" required:"false"`
|
2019-06-19 11:07:23 -04:00
|
|
|
// Identical to vboxmanage,
|
|
|
|
// except that it is run after the virtual machine is shutdown, and before the
|
|
|
|
// virtual machine is exported.
|
|
|
|
VBoxManagePost [][]string `mapstructure:"vboxmanage_post" required:"false"`
|
2013-12-22 12:24:29 -05:00
|
|
|
}
|
|
|
|
|
2015-05-27 17:01:08 -04:00
|
|
|
func (c *VBoxManageConfig) Prepare(ctx *interpolate.Context) []error {
|
2013-12-22 12:24:29 -05:00
|
|
|
if c.VBoxManage == nil {
|
|
|
|
c.VBoxManage = make([][]string, 0)
|
|
|
|
}
|
|
|
|
|
2019-06-19 11:07:23 -04:00
|
|
|
if c.VBoxManagePost == nil {
|
|
|
|
c.VBoxManagePost = make([][]string, 0)
|
|
|
|
}
|
|
|
|
|
2016-02-02 15:41:43 -05:00
|
|
|
return nil
|
2013-12-22 12:24:29 -05:00
|
|
|
}
|