@@ -12,14 +12,14 @@ import (
1212 "path/filepath"
1313 "runtime"
1414
15- "github.com/lima-vm/lima/v2/pkg/autostart/launchd"
16- "github.com/lima-vm/lima/v2/pkg/autostart/systemd"
1715 "github.com/lima-vm/lima/v2/pkg/limatype"
1816 "github.com/lima-vm/lima/v2/pkg/textutil"
1917)
2018
2119type notSupportedManager struct {}
2220
21+ var _ autoStartManager = (* notSupportedManager )(nil )
22+
2323var ErrNotSupported = fmt .Errorf ("autostart is not supported on %s" , runtime .GOOS )
2424
2525func (* notSupportedManager ) IsRegistered (_ context.Context , _ * limatype.Instance ) (bool , error ) {
@@ -46,26 +46,6 @@ func (*notSupportedManager) RequestStop(_ context.Context, _ *limatype.Instance)
4646 return false , ErrNotSupported
4747}
4848
49- // Launchd is the autostart manager for macOS.
50- var Launchd = & TemplateFileBasedManager {
51- filePath : launchd .GetPlistPath ,
52- template : launchd .Template ,
53- enabler : launchd .EnableDisableService ,
54- autoStartedIdentifier : launchd .AutoStartedServiceName ,
55- requestStart : launchd .RequestStart ,
56- requestStop : launchd .RequestStop ,
57- }
58-
59- // Systemd is the autostart manager for Linux.
60- var Systemd = & TemplateFileBasedManager {
61- filePath : systemd .GetUnitPath ,
62- template : systemd .Template ,
63- enabler : systemd .EnableDisableUnit ,
64- autoStartedIdentifier : systemd .AutoStartedUnitName ,
65- requestStart : systemd .RequestStart ,
66- requestStop : systemd .RequestStop ,
67- }
68-
6949// TemplateFileBasedManager is an autostart manager that uses a template file to create the autostart entry.
7050type TemplateFileBasedManager struct {
7151 enabler func (ctx context.Context , enable bool , instName string ) error
@@ -76,6 +56,8 @@ type TemplateFileBasedManager struct {
7656 requestStop func (ctx context.Context , inst * limatype.Instance ) (bool , error )
7757}
7858
59+ var _ autoStartManager = (* TemplateFileBasedManager )(nil )
60+
7961func (t * TemplateFileBasedManager ) IsRegistered (_ context.Context , inst * limatype.Instance ) (bool , error ) {
8062 if t .filePath == nil {
8163 return false , errors .New ("no filePath function available" )
0 commit comments