Floppy directories are provided by default with common.floppydrives

This commit is contained in:
Taliesin Sisson 2017-06-19 21:22:55 +01:00 committed by Vijaya Bhaskar Reddy Kondreddi
parent 2fbe0b4a7f
commit 5f2c71f7d7
4 changed files with 66 additions and 65 deletions

View File

@ -325,6 +325,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&common.StepCreateFloppy{ &common.StepCreateFloppy{
Files: b.config.FloppyConfig.FloppyFiles, Files: b.config.FloppyConfig.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories, Directories: b.config.FloppyConfig.FloppyDirectories,
Directories: b.config.FloppyConfig.FloppyDirectories,
}, },
&common.StepHTTPServer{ &common.StepHTTPServer{
HTTPDir: b.config.HTTPDir, HTTPDir: b.config.HTTPDir,

View File

@ -50,16 +50,7 @@ type Config struct {
// The size, in megabytes, of the computer memory in the VM. // The size, in megabytes, of the computer memory in the VM.
// By default, this is 1024 (about 1 GB). // By default, this is 1024 (about 1 GB).
RamSize uint `mapstructure:"ram_size"` RamSize uint `mapstructure:"ram_size"`
// A list of files to place onto a floppy disk that is attached when the
// VM is booted. This is most useful for unattended Windows installs,
// which look for an Autounattend.xml file on removable media. By default,
// no floppy will be attached. All files listed in this setting get
// placed into the root directory of the floppy and the floppy is attached
// as the first floppy device. Currently, no support exists for creating
// sub-directories on the floppy. Wildcard characters (*, ?, and [])
// are allowed. Directory names are also allowed, which will add all
// the files found in the directory to the floppy.
FloppyFiles []string `mapstructure:"floppy_files"`
// //
SecondaryDvdImages []string `mapstructure:"secondary_iso_images"` SecondaryDvdImages []string `mapstructure:"secondary_iso_images"`
@ -214,7 +205,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
} }
if b.config.Generation == 2 { if b.config.Generation == 2 {
if len(b.config.FloppyFiles) > 0 { if len(b.config.FloppyFiles) > 0 || len(b.config.FloppyDirectories) > 0 {
err = errors.New("Generation 2 vms don't support floppy drives. Use ISO image instead.") err = errors.New("Generation 2 vms don't support floppy drives. Use ISO image instead.")
errs = packer.MultiErrorAppend(errs, err) errs = packer.MultiErrorAppend(errs, err)
} }
@ -385,6 +376,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
steps = append(steps, steps = append(steps,
&common.StepCreateFloppy{ &common.StepCreateFloppy{
Files: b.config.FloppyFiles, Files: b.config.FloppyFiles,
Directories: b.config.FloppyConfig.FloppyDirectories,
}, },
&common.StepHTTPServer{ &common.StepHTTPServer{
HTTPDir: b.config.HTTPDir, HTTPDir: b.config.HTTPDir,

View File

@ -113,6 +113,14 @@ can be configured for this builder.
characters (*, ?, and []) are allowed. Directory names are also allowed, characters (*, ?, and []) are allowed. Directory names are also allowed,
which will add all the files found in the directory to the floppy. which will add all the files found in the directory to the floppy.
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
The maximum summary size of all files in the listed directories are the
same as in `floppy_files`.
- `guest_additions_mode` (string) - How should guest additions be installed. - `guest_additions_mode` (string) - How should guest additions be installed.
If value `attach` then attach iso image with by specified by `guest_additions_path`. If value `attach` then attach iso image with by specified by `guest_additions_path`.
Otherwise guest additions is not installed. Otherwise guest additions is not installed.
@ -196,7 +204,7 @@ can be configured for this builder.
this to an empty string, Packer will try to determine the switch to use by looking for this to an empty string, Packer will try to determine the switch to use by looking for
external switch that is up and running. external switch that is up and running.
- `switch_vlan_id` (string) - This is the vlan of the virtual switch's network card. - switch_vlan_id` (string) - This is the vlan of the virtual switch's network card.
By default none is set. If none is set then a vlan is not set on the switch's network card. By default none is set. If none is set then a vlan is not set on the switch's network card.
If this value is set it should match the vlan specified in by `vlan_id`. If this value is set it should match the vlan specified in by `vlan_id`.