inits/cmd/dkl-system-init/simple-service.go

24 lines
315 B
Go
Raw Normal View History

2018-07-06 08:07:37 +00:00
package main
type Oneshot struct {
Name string
Needs []string
Func func() error
}
func (s Oneshot) GetName() string {
return s.Name
}
func (s Oneshot) CanStart() bool {
return services.HasFlag(s.Needs...)
}
func (s Oneshot) Run(_ func()) error {
return s.Func()
}
func (s Oneshot) Stop() {
// no-op
}