diff options
Diffstat (limited to 'actions/run_action.go')
-rw-r--r-- | actions/run_action.go | 16 |
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) |