service: fix templates. Add full test.

This commit is contained in:
Daniel Theophanes
2015-03-07 09:42:36 -08:00
parent 1e3a000092
commit 9056e1f7ee
2 changed files with 90 additions and 9 deletions
+5 -9
View File
@@ -188,15 +188,11 @@ func (s *linuxService) Install() error {
}
var to = &struct {
Display string
Description string
Path string
Arguments []string
*Config
Path string
}{
s.DisplayName,
s.Description,
s.Config,
path,
s.Config.Arguments,
}
err = flavor.Template().Execute(f, to)
@@ -319,7 +315,7 @@ const systemVScript = `#!/bin/sh
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: {{.Display}}
# Short-Description: {{.DisplayName}}
# Description: {{.Description}}
### END INIT INFO
@@ -405,7 +401,7 @@ exit 0`
// the program before the Stop handler can run.
const upstartScript = `# {{.Description}}
description "{{.Display}}"
{{if .DisplayName}}description "{{.DisplayName}}"{{end}}
kill signal INT
start on filesystem or runlevel [2345]