Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
d731dcd8
Commit
d731dcd8
authored
Dec 22, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: floppy files config
parent
598822d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
18 deletions
+54
-18
builder/virtualbox/common/floppy_config.go
builder/virtualbox/common/floppy_config.go
+31
-0
builder/virtualbox/common/floppy_config_test.go
builder/virtualbox/common/floppy_config_test.go
+18
-0
builder/virtualbox/iso/builder.go
builder/virtualbox/iso/builder.go
+1
-15
builder/virtualbox/ovf/builder.go
builder/virtualbox/ovf/builder.go
+3
-3
builder/virtualbox/ovf/config.go
builder/virtualbox/ovf/config.go
+1
-0
No files found.
builder/virtualbox/common/floppy_config.go
0 → 100644
View file @
d731dcd8
package
common
import
(
"fmt"
"github.com/mitchellh/packer/packer"
)
// FloppyConfig is configuration related to created floppy disks and attaching
// them to a VirtualBox machine.
type
FloppyConfig
struct
{
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
}
func
(
c
*
FloppyConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
if
c
.
FloppyFiles
==
nil
{
c
.
FloppyFiles
=
make
([]
string
,
0
)
}
errs
:=
make
([]
error
,
0
)
for
i
,
file
:=
range
c
.
FloppyFiles
{
var
err
error
c
.
FloppyFiles
[
i
],
err
=
t
.
Process
(
file
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing floppy_files[%d]: %s"
,
i
,
err
))
}
}
return
errs
}
builder/virtualbox/common/floppy_config_test.go
0 → 100644
View file @
d731dcd8
package
common
import
(
"testing"
)
func
TestFloppyConfigPrepare
(
t
*
testing
.
T
)
{
c
:=
new
(
FloppyConfig
)
errs
:=
c
.
Prepare
(
testConfigTemplate
(
t
))
if
len
(
errs
)
>
0
{
t
.
Fatalf
(
"err: %#v"
,
errs
)
}
if
len
(
c
.
FloppyFiles
)
>
0
{
t
.
Fatal
(
"should not have floppy files"
)
}
}
builder/virtualbox/iso/builder.go
View file @
d731dcd8
...
...
@@ -30,11 +30,11 @@ type Builder struct {
type
config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
BootCommand
[]
string
`mapstructure:"boot_command"`
DiskSize
uint
`mapstructure:"disk_size"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
Format
string
`mapstructure:"format"`
GuestAdditionsMode
string
`mapstructure:"guest_additions_mode"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
...
...
@@ -93,10 +93,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b
.
config
.
DiskSize
=
40000
}
if
b
.
config
.
FloppyFiles
==
nil
{
b
.
config
.
FloppyFiles
=
make
([]
string
,
0
)
}
if
b
.
config
.
GuestAdditionsMode
==
""
{
b
.
config
.
GuestAdditionsMode
=
"upload"
}
...
...
@@ -212,16 +208,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
}
}
for
i
,
file
:=
range
b
.
config
.
FloppyFiles
{
var
err
error
b
.
config
.
FloppyFiles
[
i
],
err
=
b
.
config
.
tpl
.
Process
(
file
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing floppy_files[%d]: %s"
,
i
,
err
))
}
}
if
!
(
b
.
config
.
Format
==
"ovf"
||
b
.
config
.
Format
==
"ova"
)
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"invalid format, only 'ovf' or 'ova' are allowed"
))
...
...
builder/virtualbox/ovf/builder.go
View file @
d731dcd8
...
...
@@ -47,10 +47,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Path
:
b
.
config
.
OutputDir
,
},
new
(
vboxcommon
.
StepSuppressMessages
),
&
common
.
StepCreateFloppy
{
Files
:
b
.
config
.
FloppyFiles
,
},
/*
&common.StepCreateFloppy{
Files: b.config.FloppyFiles,
},
new(stepAttachGuestAdditions),
new(stepAttachFloppy),
new(stepForwardSSH),
...
...
builder/virtualbox/ovf/config.go
View file @
d731dcd8
...
...
@@ -9,6 +9,7 @@ import (
// Config is the configuration structure for the builder.
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
FloppyConfig
`mapstructure:",squash"`
vboxcommon
.
OutputConfig
`mapstructure:",squash"`
tpl
*
packer
.
ConfigTemplate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment