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
dd356d33
Commit
dd356d33
authored
Sep 26, 2013
by
Matthew Hooker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notes/reorg.
parent
5086ff1a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
builder/amazon/chroot/communicator.go
builder/amazon/chroot/communicator.go
+16
-16
builder/amazon/chroot/step_copy_files.go
builder/amazon/chroot/step_copy_files.go
+6
-0
No files found.
builder/amazon/chroot/communicator.go
View file @
dd356d33
...
...
@@ -52,22 +52,6 @@ func (c *Communicator) Start(cmd *packer.RemoteCmd) error {
return
nil
}
func
(
c
*
Communicator
)
Upload
(
dst
string
,
r
io
.
Reader
)
error
{
dst
=
filepath
.
Join
(
c
.
Chroot
,
dst
)
log
.
Printf
(
"Uploading to chroot dir: %s"
,
dst
)
f
,
err
:=
os
.
Create
(
dst
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
if
_
,
err
:=
io
.
Copy
(
f
,
r
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
c
*
Communicator
)
UploadDir
(
dst
string
,
src
string
,
exclude
[]
string
)
error
{
walkFn
:=
func
(
fullPath
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
...
...
@@ -100,6 +84,22 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
return
filepath
.
Walk
(
src
,
walkFn
)
}
func
(
c
*
Communicator
)
Upload
(
dst
string
,
r
io
.
Reader
)
error
{
dst
=
filepath
.
Join
(
c
.
Chroot
,
dst
)
log
.
Printf
(
"Uploading to chroot dir: %s"
,
dst
)
f
,
err
:=
os
.
Create
(
dst
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
if
_
,
err
:=
io
.
Copy
(
f
,
r
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
c
*
Communicator
)
Download
(
src
string
,
w
io
.
Writer
)
error
{
src
=
filepath
.
Join
(
c
.
Chroot
,
src
)
log
.
Printf
(
"Downloading from chroot dir: %s"
,
src
)
...
...
builder/amazon/chroot/step_copy_files.go
View file @
dd356d33
...
...
@@ -68,6 +68,12 @@ func (s *StepCopyFiles) CleanupFunc(multistep.StateBag) error {
return
nil
}
/* TODO: move to util file.
* change prototype to
func copySingle(dst string, src string, copyCommand string) error
* I think we should switch to cp for copying files, then allow specifying a copy_files_command or something.
Maybe we should just do a execute_wrapper that allows you to wrap every command...
*/
func
(
s
*
StepCopyFiles
)
copySingle
(
dst
,
src
string
)
error
{
// Stat the src file so we can copy the mode later
srcInfo
,
err
:=
os
.
Stat
(
src
)
...
...
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