add the floppy label option

This commit is contained in:
allinwait 2019-09-12 12:25:22 +00:00
parent 2e58b807de
commit 171c2a9a07
20 changed files with 64 additions and 2 deletions

View File

@ -393,6 +393,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -432,6 +432,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -169,6 +169,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -61,6 +61,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&StepImport{
Name: b.config.VMName,

View File

@ -413,6 +413,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
new(stepCreateDisk),
new(stepCopyDisk),

View File

@ -223,6 +223,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -57,6 +57,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&common.StepHTTPServer{
HTTPDir: b.config.HTTPDir,

View File

@ -86,6 +86,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&stepRemoteUpload{
Key: "floppy_path",

View File

@ -82,6 +82,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&StepCloneVMX{
OutputDir: b.config.OutputDir,

View File

@ -12,6 +12,7 @@ import (
type FloppyConfig struct {
FloppyFiles []string `mapstructure:"floppy_files"`
FloppyDirectories []string `mapstructure:"floppy_dirs"`
FloppyLabel string `mapstructure:"floppy_label"`
}
func (c *FloppyConfig) Prepare(ctx *interpolate.Context) []error {

View File

@ -21,6 +21,7 @@ import (
type StepCreateFloppy struct {
Files []string
Directories []string
Label string
floppyPath string
@ -33,6 +34,12 @@ func (s *StepCreateFloppy) Run(ctx context.Context, state multistep.StateBag) mu
return multistep.ActionContinue
}
if s.Label == "" {
s.Label = "packer"
} else {
log.Println("Floppy label is set to %s", s.Label)
}
s.FilesAdded = make(map[string]bool)
ui := state.Get("ui").(packer.Ui)
@ -70,8 +77,8 @@ func (s *StepCreateFloppy) Run(ctx context.Context, state multistep.StateBag) mu
log.Println("Formatting the block device with a FAT filesystem...")
formatConfig := &fat.SuperFloppyConfig{
FATType: fat.FAT12,
Label: "packer",
OEMName: "packer",
Label: s.Label,
OEMName: s.Label,
}
if err := fat.FormatSuperFloppy(device, formatConfig); err != nil {
state.Put("error", fmt.Errorf("Error creating floppy: %s", err))

View File

@ -134,6 +134,11 @@ builder.
(`*`, `?`, and `[]`) are allowed. Directory names are also allowed, which
will add all the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `generation` (number) - The Hyper-V generation for the virtual machine. By
default, this is 1. Generation 2 Hyper-V virtual machines do not support
floppy drives. In this scenario use `secondary_iso_images` instead. Hard

View File

@ -171,6 +171,11 @@ builder.
(`*`, `?`, and `[]`) are allowed. Directory names are also allowed, which
will add all the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `guest_additions_mode` (string) - If set to `attach` then attach and
mount the ISO image specified in `guest_additions_path`. If set to
`none` then guest additions are not attached and mounted; This is the

View File

@ -111,6 +111,11 @@ builder.
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `guest_os_type` (string) - The guest OS type being installed. By default
this is "other", but you can get *dramatic* performance improvements by
setting this to the proper value. To view all available values for this run

View File

@ -95,6 +95,11 @@ builder.
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`

View File

@ -209,6 +209,11 @@ Linux server and have not enabled X11 forwarding (`ssh -X`).
listed files must not exceed 1.44 MB. The supported ways to move large
files into the OS are using `http_directory` or [the file provisioner](https://www.packer.io/docs/provisioners/file.html).
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `format` (string) - Either `qcow2` or `raw`, this specifies the output
format of the virtual machine image. This defaults to `qcow2`.

View File

@ -136,6 +136,11 @@ builder.
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `format` (string) - Either `ovf` or `ova`, this specifies the output format
of the exported virtual machine. This defaults to `ovf`.

View File

@ -153,6 +153,11 @@ builder.
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `format` (string) - Either `ovf` or `ova`, this specifies the output format
of the exported virtual machine. This defaults to `ovf`.

View File

@ -160,6 +160,11 @@ builder.
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this is
`/Applications/VMware Fusion.app` but this setting allows you to
customize this.

View File

@ -102,6 +102,11 @@ builder.
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this is
`/Applications/VMware Fusion.app` but this setting allows you to
customize this.