summaryrefslogtreecommitdiff
path: root/actions/pack_action.go
diff options
context:
space:
mode:
authorHéctor Orón Martínez <zumbi@debian.org>2018-01-09 19:12:07 +0100
committerHéctor Orón Martínez <zumbi@debian.org>2018-01-09 19:12:07 +0100
commit4808cb7058c548bf76476ec2f9618d784d76bdda (patch)
tree1dc1e8cc24171783fc8d9da306b1e92798960a15 /actions/pack_action.go
New upstream version 1.0.0+git20171222.87b0d5e
Diffstat (limited to 'actions/pack_action.go')
-rw-r--r--actions/pack_action.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/actions/pack_action.go b/actions/pack_action.go
new file mode 100644
index 0000000..a90cb1d
--- /dev/null
+++ b/actions/pack_action.go
@@ -0,0 +1,39 @@
+/*
+Pack Action
+
+Create tarball with filesystem.
+
+Yaml syntax:
+ - action: pack
+ file: filename.ext
+ compression: gz
+
+Mandatory properties:
+
+- file -- name of the output tarball.
+
+- compression -- compression type to use. Only 'gz' is supported at the moment.
+
+*/
+package actions
+
+import (
+ "log"
+ "path"
+
+ "github.com/go-debos/debos"
+)
+
+type PackAction struct {
+ debos.BaseAction `yaml:",inline"`
+ Compression string
+ File string
+}
+
+func (pf *PackAction) Run(context *debos.DebosContext) error {
+ pf.LogStart()
+ outfile := path.Join(context.Artifactdir, pf.File)
+
+ log.Printf("Compression to %s\n", outfile)
+ return debos.Command{}.Run("Packing", "tar", "czf", outfile, "-C", context.Rootdir, ".")
+}