|
|
|
|
@ -29,12 +29,9 @@ type Config struct {
|
|
|
|
|
ChrootMounts [][]string `mapstructure:"chroot_mounts"`
|
|
|
|
|
CopyFiles []string `mapstructure:"copy_files"`
|
|
|
|
|
DevicePath string `mapstructure:"device_path"`
|
|
|
|
|
MountCommand string `mapstructure:"mount_command"`
|
|
|
|
|
ChrootCommand string `mapstructure:"chroot_command"`
|
|
|
|
|
CopyCommand string `mapstructure:"copy_command"`
|
|
|
|
|
CommandWrapper string `mapstructure:"command_wrapper"`
|
|
|
|
|
MountPath string `mapstructure:"mount_path"`
|
|
|
|
|
SourceAmi string `mapstructure:"source_ami"`
|
|
|
|
|
UnmountCommand string `mapstructure:"unmount_command"`
|
|
|
|
|
|
|
|
|
|
tpl *packer.ConfigTemplate
|
|
|
|
|
}
|
|
|
|
|
@ -80,26 +77,14 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
|
|
|
|
b.config.CopyFiles = []string{"/etc/resolv.conf"}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.MountCommand == "" {
|
|
|
|
|
b.config.MountCommand = "mount"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.ChrootCommand == "" {
|
|
|
|
|
b.config.ChrootCommand = "chroot"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.CopyCommand == "" {
|
|
|
|
|
b.config.CopyCommand = "cp"
|
|
|
|
|
if b.config.CommandWrapper == "" {
|
|
|
|
|
b.config.CommandWrapper = "{{.Command}}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.MountPath == "" {
|
|
|
|
|
b.config.MountPath = "packer-amazon-chroot-volumes/{{.Device}}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.UnmountCommand == "" {
|
|
|
|
|
b.config.UnmountCommand = "umount"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Accumulate any errors
|
|
|
|
|
errs := common.CheckUnusedConfig(md)
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(b.config.tpl)...)
|
|
|
|
|
@ -137,12 +122,8 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
templates := map[string]*string{
|
|
|
|
|
"device_path": &b.config.DevicePath,
|
|
|
|
|
"mount_command": &b.config.MountCommand,
|
|
|
|
|
"chroot_command": &b.config.ChrootCommand,
|
|
|
|
|
"copy_command": &b.config.CopyCommand,
|
|
|
|
|
"source_ami": &b.config.SourceAmi,
|
|
|
|
|
"unmount_command": &b.config.UnmountCommand,
|
|
|
|
|
"device_path": &b.config.DevicePath,
|
|
|
|
|
"source_ami": &b.config.SourceAmi,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for n, ptr := range templates {
|
|
|
|
|
|