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
+7
-1
@@ -8,11 +8,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "freebsd"
|
const version = "freebsd"
|
||||||
|
const configDir = "/usr/local/etc/rc.d"
|
||||||
|
|
||||||
type freebsdSystem struct{}
|
type freebsdSystem struct{}
|
||||||
|
|
||||||
@@ -88,7 +90,11 @@ func (s *freebsdService) template() *template.Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *freebsdService) configPath() (cp string, err error) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user