File tree Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -3,28 +3,33 @@ package main
3
3
import (
4
4
"errors"
5
5
"fmt"
6
+ "runtime"
7
+
6
8
"github.com/lima-vm/lima/pkg/networks"
7
9
"github.com/spf13/cobra"
8
10
)
9
11
10
12
func newSudoersCommand () * cobra.Command {
11
13
sudoersCommand := & cobra.Command {
12
- Use : "sudoers [SUDOERSFILE]" ,
13
- Short : "Generate /etc/sudoers.d/lima file." ,
14
- Args : cobra .MaximumNArgs (1 ),
15
- RunE : sudoersAction ,
14
+ Use : "sudoers [SUDOERSFILE]" ,
15
+ Short : "Generate /etc/sudoers.d/lima file." ,
16
+ Args : cobra .MaximumNArgs (1 ),
17
+ RunE : sudoersAction ,
16
18
}
17
19
sudoersCommand .Flags ().Bool ("check" , false ,
18
20
"check that the sudoers file is up-to-date with $LIMA_HOME/_config/networks.yaml" )
19
21
return sudoersCommand
20
22
}
21
23
22
24
func sudoersAction (cmd * cobra.Command , args []string ) error {
25
+ if runtime .GOOS != "darwin" {
26
+ return errors .New ("sudoers command is only supported on macOS right now" )
27
+ }
23
28
check , err := cmd .Flags ().GetBool ("check" )
24
29
if err != nil {
25
30
return err
26
31
}
27
- if check {
32
+ if check {
28
33
var file string
29
34
switch len (args ) {
30
35
case 0 :
Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ func validateNetwork(y LimaYAML) error {
179
179
for i , nw := range y .Networks {
180
180
field := fmt .Sprintf ("networks[%d]" , i )
181
181
if nw .Lima != "" {
182
+ if runtime .GOOS != "darwin" {
183
+ return fmt .Errorf ("field `%s.lima` is only supported on macOS right now" , field )
184
+ }
182
185
if nw .VNL != "" {
183
186
return fmt .Errorf ("field `%s.lima` and field `%s.vnl` are mutually exclusive" , field , field )
184
187
}
Original file line number Diff line number Diff line change 7
7
"gopkg.in/yaml.v2"
8
8
"os"
9
9
"path/filepath"
10
+ "runtime"
10
11
"sync"
11
12
12
13
"github.com/lima-vm/lima/pkg/store"
@@ -60,8 +61,11 @@ func load() {
60
61
61
62
// Config returns the network config from the _config/networks.yaml file.
62
63
func Config () (NetworksConfig , error ) {
63
- load ()
64
- return cache .config , cache .err
64
+ if runtime .GOOS == "darwin" {
65
+ load ()
66
+ return cache .config , cache .err
67
+ }
68
+ return NetworksConfig {}, errors .New ("networks.yaml configuration is only supported on macOS right now" )
65
69
}
66
70
67
71
func VDESock (name string ) (string , error ) {
Original file line number Diff line number Diff line change 6
6
"fmt"
7
7
"os"
8
8
"os/exec"
9
+ "runtime"
9
10
"strings"
10
11
"sync"
11
12
@@ -14,6 +15,9 @@ import (
14
15
)
15
16
16
17
func Reconcile (ctx context.Context , newInst string ) error {
18
+ if runtime .GOOS != "darwin" {
19
+ return nil
20
+ }
17
21
config , err := Config ()
18
22
if err != nil {
19
23
return err
You can’t perform that action at this time.
0 commit comments