add support for overriding service templates at runtime

This commit is contained in:
SteelPhase
2018-08-21 07:42:03 -04:00
committed by Daniel Theophanes
parent 994866c14a
commit e5178e50d2
5 changed files with 59 additions and 20 deletions
+8 -1
View File
@@ -45,8 +45,15 @@ func (s *sysv) configPath() (cp string, err error) {
cp = "/etc/init.d/" + s.Config.Name
return
}
func (s *sysv) template() *template.Template {
return template.Must(template.New("").Funcs(tf).Parse(sysvScript))
customScript := s.Option.string(optionSysvScript, "")
if customScript != "" {
return template.Must(template.New("").Funcs(tf).Parse(customScript))
} else {
return template.Must(template.New("").Funcs(tf).Parse(sysvScript))
}
}
func (s *sysv) Install() error {