summaryrefslogtreecommitdiff
path: root/actions/run_action.go
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2020-10-14 22:18:31 +0200
committerAndrej Shadura <andrew.shadura@collabora.co.uk>2020-10-14 22:18:31 +0200
commit4e972d6d6743bed5dd638e95dd1fdbadc2eaf89e (patch)
treed8d73b99967c44198bd25e4906c7d7b763d81cbe /actions/run_action.go
parentdae893c4893e9c32c62ce7b477b62b49b864de2a (diff)
parent9c6de646795022f856ed7c22d28e2d63e4c0ca22 (diff)
Update upstream source from tag 'upstream/1.0.0+git20200909.d2ab9d3'
Update to upstream version '1.0.0+git20200909.d2ab9d3' with Debian dir db4083400488263e917de99d795542cd87fa9019
Diffstat (limited to 'actions/run_action.go')
-rw-r--r--actions/run_action.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/actions/run_action.go b/actions/run_action.go
index 8d36228..13159d1 100644
--- a/actions/run_action.go
+++ b/actions/run_action.go
@@ -2,7 +2,8 @@
Run Action
Allows to run any available command or script in the filesystem or
-in host environment.
+in build process host environment: specifically inside the fakemachine created
+by Debos.
Yaml syntax:
- action: run
@@ -24,8 +25,10 @@ Optional properties:
- chroot -- run script or command in target filesystem if set to true.
Otherwise the command or script is executed within the build process, with
access to the filesystem ($ROOTDIR), the image if any ($IMAGE), the
-recipe directory ($RECIPEDIR) and the artifact directory ($ARTIFACTDIR).
-In both cases it is run with root privileges.
+recipe directory ($RECIPEDIR), the artifact directory ($ARTIFACTDIR) and the
+directory where the image is mounted ($IMAGEMNTDIR).
+In both cases it is run with root privileges. If unset, chroot is set to false and
+the command or script is run in the host environment.
- label -- if non-empty, this string is used to label output. If empty,
a label is derived from the command or script.
@@ -60,6 +63,10 @@ func (run *RunAction) Verify(context *debos.DebosContext) error {
if run.PostProcess && run.Chroot {
return errors.New("Cannot run postprocessing in the chroot")
}
+
+ if run.Script == "" && run.Command == "" {
+ return errors.New("Script and Command both cannot be empty")
+ }
return nil
}
@@ -120,6 +127,9 @@ func (run *RunAction) doRun(context debos.DebosContext) error {
cmd.AddEnvKey("ROOTDIR", context.Rootdir)
cmd.AddEnvKey("RECIPEDIR", context.RecipeDir)
cmd.AddEnvKey("ARTIFACTDIR", context.Artifactdir)
+ if context.ImageMntDir != "" {
+ cmd.AddEnvKey("IMAGEMNTDIR", context.ImageMntDir)
+ }
}
if context.Image != "" {
cmd.AddEnvKey("IMAGE", context.Image)