mirror of
https://github.com/kardianos/service.git
synced 2025-12-24 13:27:57 +08:00
freebsd: ensure config directory is created
Otherwise, freebsdService.Install will fail because config file could not be created. Fixes #359
This commit is contained in:
committed by
Daniel Theophanes
parent
3596dfaf34
commit
9832e01049
@@ -8,11 +8,13 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
const version = "freebsd"
|
||||
const configDir = "/usr/local/etc/rc.d"
|
||||
|
||||
type freebsdSystem struct{}
|
||||
|
||||
@@ -88,7 +90,11 @@ func (s *freebsdService) template() *template.Template {
|
||||
}
|
||||
|
||||
func (s *freebsdService) configPath() (cp string, err error) {
|
||||
cp = "/usr/local/etc/rc.d/" + s.Config.Name
|
||||
if oserr := os.MkdirAll(configDir, 0755); oserr != nil {
|
||||
err = oserr
|
||||
return
|
||||
}
|
||||
cp = filepath.Join(configDir, s.Config.Name)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user