Merge pull request #7948 from DanHam/shell-local-fixes
Fix incorrect `execute_command` defaults in shell-local post-processor docs
This commit is contained in:
commit
d78c8040a8
|
@ -47,7 +47,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force shell-local pp to keep the input artifact, because otherwise we'll
|
// Force shell-local pp to keep the input artifact, because otherwise we'll
|
||||||
// lose it instead of being able to pass it through. If oyu want to delete
|
// lose it instead of being able to pass it through. If you want to delete
|
||||||
// the input artifact for a shell local pp, use the artifice pp to create a
|
// the input artifact for a shell local pp, use the artifice pp to create a
|
||||||
// new artifact
|
// new artifact
|
||||||
return artifact, true, true, retErr
|
return artifact, true, true, retErr
|
||||||
|
|
|
@ -68,18 +68,29 @@ Optional parameters:
|
||||||
it is necessary below.
|
it is necessary below.
|
||||||
|
|
||||||
- `execute_command` (array of strings) - The command used to execute the
|
- `execute_command` (array of strings) - The command used to execute the
|
||||||
script. By default this is `["/bin/sh", "-c", "{{.Vars}}", "{{.Script}}"]`
|
script. By default, on *nix systems this is:
|
||||||
on unix and `["cmd", "/c", "{{.Vars}}", "{{.Script}}"]` on windows. This is
|
|
||||||
treated as a [template engine](/docs/templates/engine.html). There are two
|
```
|
||||||
available variables: `Script`, which is the path to the script to run, and
|
["/bin/sh", "-c", "{{.Vars}} {{.Script}}"]
|
||||||
`Vars`, which is the list of `environment_vars`, if configured. If you
|
```
|
||||||
choose to set this option, make sure that the first element in the array is
|
|
||||||
the shell program you want to use (for example, "sh" or
|
While on Windows, `execute_command` defaults to:
|
||||||
"/usr/local/bin/zsh" or even "powershell.exe" although anything other than
|
|
||||||
a flavor of the shell command language is not explicitly supported and may
|
```
|
||||||
be broken by assumptions made within Packer). It's worth noting that if you
|
["cmd", "/V", "/C", "{{.Vars}}", "call", "{{.Script}}"]
|
||||||
choose to try to use shell-local for Powershell or other Windows commands,
|
```
|
||||||
the environment variables will not be set properly for your environment.
|
|
||||||
|
This is treated as a [template engine](/docs/templates/engine.html).
|
||||||
|
There are two available variables: `Script`, which is the path to the
|
||||||
|
script to run, and `Vars`, which is the list of `environment_vars`, if
|
||||||
|
configured. If you choose to set this option, make sure that the first
|
||||||
|
element in the array is the shell program you want to use (for example,
|
||||||
|
"sh" or "/usr/local/bin/zsh" or even "powershell.exe" although anything
|
||||||
|
other than a flavor of the shell command language is not explicitly
|
||||||
|
supported and may be broken by assumptions made within Packer). It's
|
||||||
|
worth noting that if you choose to try to use shell-local for
|
||||||
|
Powershell or other Windows commands, the environment variables will
|
||||||
|
not be set properly for your environment.
|
||||||
|
|
||||||
For backwards compatibility, `execute_command` will accept a string instead
|
For backwards compatibility, `execute_command` will accept a string instead
|
||||||
of an array of strings. If a single string or an array of strings with only
|
of an array of strings. If a single string or an array of strings with only
|
||||||
|
|
Loading…
Reference in New Issue