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
618e1b16
Commit
618e1b16
authored
Jul 30, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/chroot: process MountPath template
parent
8d5f404f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
builder/amazon/chroot/step_mount_device.go
builder/amazon/chroot/step_mount_device.go
+16
-1
No files found.
builder/amazon/chroot/step_mount_device.go
View file @
618e1b16
...
...
@@ -8,8 +8,14 @@ import (
"log"
"os"
"os/exec"
"path/filepath"
"text/template"
)
type
mountPathData
struct
{
Device
string
}
// StepMountDevice mounts the attached device.
//
// Produces:
...
...
@@ -23,7 +29,13 @@ func (s *StepMountDevice) Run(state map[string]interface{}) multistep.StepAction
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
device
:=
state
[
"device"
]
.
(
string
)
mountPath
:=
config
.
MountPath
mountPathRaw
:=
new
(
bytes
.
Buffer
)
t
:=
template
.
Must
(
template
.
New
(
"mountPath"
)
.
Parse
(
config
.
MountPath
))
t
.
Execute
(
mountPathRaw
,
&
mountPathData
{
Device
:
filepath
.
Basename
(
device
),
})
mountPath
:=
mountPathRaw
.
String
()
log
.
Printf
(
"Mount path: %s"
,
mountPath
)
if
err
:=
os
.
MkdirAll
(
mountPath
,
0755
);
err
!=
nil
{
...
...
@@ -46,6 +58,9 @@ func (s *StepMountDevice) Run(state map[string]interface{}) multistep.StepAction
return
multistep
.
ActionHalt
}
// Set the mount path so we remember to unmount it later
s
.
mountPath
=
mountPath
return
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