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
@@ -52,8 +52,15 @@ func (s *systemd) configPath() (cp string, err error) {
cp = "/etc/systemd/system/" + s.Config.Name + ".service"
return
}
func (s *systemd) template() *template.Template {
return template.Must(template.New("").Funcs(tf).Parse(systemdScript))
customScript := s.Option.string(optionSystemdScript, "")
if customScript != "" {
return template.Must(template.New("").Funcs(tf).Parse(customScript))
} else {
return template.Must(template.New("").Funcs(tf).Parse(systemdScript))
}
}
func (s *systemd) Install() error {