preserver BC for people using 'command' option
This commit is contained in:
parent
dd183f22d9
commit
9651432378
|
@ -15,8 +15,9 @@ import (
|
|||
)
|
||||
|
||||
type ExecuteCommandTemplate struct {
|
||||
Vars string
|
||||
Script string
|
||||
Vars string
|
||||
Script string
|
||||
Command string
|
||||
}
|
||||
|
||||
func Run(ui packer.Ui, config *Config) (bool, error) {
|
||||
|
@ -106,8 +107,9 @@ func createInlineScriptFile(config *Config) (string, error) {
|
|||
// the host OS
|
||||
func createInterpolatedCommands(config *Config, script string, flattenedEnvVars string) ([]string, error) {
|
||||
config.Ctx.Data = &ExecuteCommandTemplate{
|
||||
Vars: flattenedEnvVars,
|
||||
Script: script,
|
||||
Vars: flattenedEnvVars,
|
||||
Script: script,
|
||||
Command: script,
|
||||
}
|
||||
|
||||
interpolatedCmds := make([]string, len(config.ExecuteCommand))
|
||||
|
|
|
@ -78,18 +78,21 @@ Optional parameters:
|
|||
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), and a later element in the
|
||||
array must be `{{.Script}}`.
|
||||
|
||||
For backwards compatability, {{.Command}} is also available to use in
|
||||
`execute_command` but it is decoded the same way as {{.Script}}. We
|
||||
recommend using {{.Script}} for the sake of clarity, as even when you set
|
||||
only a single `command` to run, Packer writes it to a temporary file and
|
||||
then runs it as a script.
|
||||
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"), and a later
|
||||
element in the array must be `{{.Script}}`.
|
||||
|
||||
This option provides you a great deal of flexibility. You may choose to
|
||||
provide your own shell program, for example "/usr/local/bin/zsh" or even
|
||||
"powershell.exe". However, with great power comes great responsibility -
|
||||
these commands are not officially supported and things like environment
|
||||
variables may not work if you use a different shell than the default.
|
||||
|
||||
For backwards compatability, you may also use {{.Command}}, but it is
|
||||
decoded the same way as {{.Script}}. We recommend using {{.Script}} for the
|
||||
sake of clarity, as even when you set only a single `command` to run,
|
||||
Packer writes it to a temporary file and then runs it as a script.
|
||||
|
||||
- `inline_shebang` (string) - The
|
||||
[shebang](http://en.wikipedia.org/wiki/Shebang_%28Unix%29) value to use when
|
||||
|
|
Loading…
Reference in New Issue