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
1e7508c8
Commit
1e7508c8
authored
Jul 07, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt
parent
f8617b26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
49 deletions
+48
-49
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+25
-25
builder/virtualbox/builder_test.go
builder/virtualbox/builder_test.go
+0
-1
builder/virtualbox/step_download_guest_additions.go
builder/virtualbox/step_download_guest_additions.go
+23
-23
No files found.
builder/virtualbox/builder.go
View file @
1e7508c8
...
...
@@ -25,31 +25,31 @@ type Builder struct {
}
type
config
struct
{
BootCommand
[]
string
`mapstructure:"boot_command"`
BootWait
time
.
Duration
``
DiskSize
uint
`mapstructure:"disk_size"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
GuestAdditionsURL
string
`mapstructure:"guest_additions_url"`
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
ISOMD5
string
`mapstructure:"iso_md5"`
ISOUrl
string
`mapstructure:"iso_url"`
OutputDir
string
`mapstructure:"output_directory"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
ShutdownTimeout
time
.
Duration
``
SSHHostPortMin
uint
`mapstructure:"ssh_host_port_min"`
SSHHostPortMax
uint
`mapstructure:"ssh_host_port_max"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHUser
string
`mapstructure:"ssh_username"`
SSHWaitTimeout
time
.
Duration
``
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VMName
string
`mapstructure:"vm_name"`
BootCommand
[]
string
`mapstructure:"boot_command"`
BootWait
time
.
Duration
``
DiskSize
uint
`mapstructure:"disk_size"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
GuestAdditionsURL
string
`mapstructure:"guest_additions_url"`
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
ISOMD5
string
`mapstructure:"iso_md5"`
ISOUrl
string
`mapstructure:"iso_url"`
OutputDir
string
`mapstructure:"output_directory"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
ShutdownTimeout
time
.
Duration
``
SSHHostPortMin
uint
`mapstructure:"ssh_host_port_min"`
SSHHostPortMax
uint
`mapstructure:"ssh_host_port_max"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHUser
string
`mapstructure:"ssh_username"`
SSHWaitTimeout
time
.
Duration
``
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VMName
string
`mapstructure:"vm_name"`
PackerBuildName
string
`mapstructure:"packer_build_name"`
PackerDebug
bool
`mapstructure:"packer_debug"`
...
...
builder/virtualbox/builder_test.go
View file @
1e7508c8
...
...
@@ -216,7 +216,6 @@ func TestBuilderPrepare_GuestAdditionsURL(t *testing.T) {
}
}
func
TestBuilderPrepare_HTTPPort
(
t
*
testing
.
T
)
{
var
b
Builder
config
:=
testConfig
()
...
...
builder/virtualbox/step_download_guest_additions.go
View file @
1e7508c8
...
...
@@ -35,7 +35,7 @@ func (s *stepDownloadGuestAdditions) Run(state map[string]interface{}) multistep
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
config
:=
state
[
"config"
]
.
(
*
config
)
// Get VBox version
// Get VBox version
version
,
err
:=
driver
.
Version
()
if
err
!=
nil
{
state
[
"error"
]
=
fmt
.
Errorf
(
"Error reading version for guest additions download: %s"
,
err
)
...
...
@@ -49,17 +49,17 @@ func (s *stepDownloadGuestAdditions) Run(state map[string]interface{}) multistep
additionsName
:=
fmt
.
Sprintf
(
"VBoxGuestAdditions_%s.iso"
,
version
)
// Use provided version or get it from virtualbox.org
var
checksum
string
// Use provided version or get it from virtualbox.org
var
checksum
string
if
config
.
GuestAdditionsSHA256
!=
""
{
checksum
=
config
.
GuestAdditionsSHA256
}
else
{
checksum
,
action
=
s
.
downloadAdditionsSHA256
(
state
,
version
,
additionsName
)
if
action
!=
multistep
.
ActionContinue
{
return
action
}
}
if
config
.
GuestAdditionsSHA256
!=
""
{
checksum
=
config
.
GuestAdditionsSHA256
}
else
{
checksum
,
action
=
s
.
downloadAdditionsSHA256
(
state
,
version
,
additionsName
)
if
action
!=
multistep
.
ActionContinue
{
return
action
}
}
checksumBytes
,
err
:=
hex
.
DecodeString
(
checksum
)
if
err
!=
nil
{
...
...
@@ -67,14 +67,14 @@ func (s *stepDownloadGuestAdditions) Run(state map[string]interface{}) multistep
return
multistep
.
ActionHalt
}
// Use the provided source (URL or file path) or generate it
url
:=
config
.
GuestAdditionsURL
if
url
==
""
{
url
=
fmt
.
Sprintf
(
"http://download.virtualbox.org/virtualbox/%s/%s"
,
version
,
additionsName
)
}
// Use the provided source (URL or file path) or generate it
url
:=
config
.
GuestAdditionsURL
if
url
==
""
{
url
=
fmt
.
Sprintf
(
"http://download.virtualbox.org/virtualbox/%s/%s"
,
version
,
additionsName
)
}
log
.
Printf
(
"Guest additions URL: %s"
,
url
)
...
...
@@ -138,12 +138,12 @@ DownloadWaitLoop:
return
result
,
multistep
.
ActionContinue
}
func
(
s
*
stepDownloadGuestAdditions
)
downloadAdditionsSHA256
(
state
map
[
string
]
interface
{},
additionsVersion
string
,
additionsName
string
)
(
string
,
multistep
.
StepAction
)
{
// First things first, we get the list of checksums for the files available
func
(
s
*
stepDownloadGuestAdditions
)
downloadAdditionsSHA256
(
state
map
[
string
]
interface
{},
additionsVersion
string
,
additionsName
string
)
(
string
,
multistep
.
StepAction
)
{
// First things first, we get the list of checksums for the files available
// for this version.
checksumsUrl
:=
fmt
.
Sprintf
(
"http://download.virtualbox.org/virtualbox/%s/SHA256SUMS"
,
additionsVersion
)
checksumsFile
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
state
[
"error"
]
=
fmt
.
Errorf
(
"Failed creating temporary file to store guest addition checksums: %s"
,
...
...
@@ -203,6 +203,6 @@ func (s *stepDownloadGuestAdditions) downloadAdditionsSHA256 (state map[string]i
return
""
,
multistep
.
ActionHalt
}
return
checksum
,
multistep
.
ActionContinue
return
checksum
,
multistep
.
ActionContinue
}
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