|
|
|
@ -25,12 +25,8 @@ func Command() (string, []string) {
|
|
|
|
|
|
|
|
|
|
// Script converts a slice of individual shell commands to
|
|
|
|
|
// a posix-compliant shell script.
|
|
|
|
|
func Script(commands []string, environ map[string]string) string {
|
|
|
|
|
func Script(commands []string) string {
|
|
|
|
|
buf := new(bytes.Buffer)
|
|
|
|
|
for k, v := range environ {
|
|
|
|
|
fmt.Fprintln(buf)
|
|
|
|
|
fmt.Fprintf(buf, exportScript, k, v)
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprintln(buf)
|
|
|
|
|
fmt.Fprintf(buf, optionScript)
|
|
|
|
|
fmt.Fprintln(buf)
|
|
|
|
@ -50,10 +46,6 @@ func Script(commands []string, environ map[string]string) string {
|
|
|
|
|
// to set shell options, in this case, to exit on error.
|
|
|
|
|
const optionScript = "set -e"
|
|
|
|
|
|
|
|
|
|
// exportScript is a helper script that is added to
|
|
|
|
|
// the build script to export environment variables.
|
|
|
|
|
const exportScript = "export %s=%q"
|
|
|
|
|
|
|
|
|
|
// traceScript is a helper script that is added to
|
|
|
|
|
// the build script to trace a command.
|
|
|
|
|
const traceScript = `
|
|
|
|
|