MCPcopy
hub / github.com/runfinch/finch / Installed

Method Installed

pkg/dependency/vmnet/sudoers_file_unix.go:45–62  ·  view source on GitHub ↗

Installed checks if any file at `s.path()` matches the output of `lima sudoers`.

()

Source from the content-addressed store, hash-verified

43
44// Installed checks if any file at `s.path()` matches the output of `lima sudoers`.
45func (s *sudoersFile) Installed() bool {
46 b, err := afero.ReadFile(s.fs, s.path())
47 if err != nil {
48 if errors.Is(err, fs.ErrNotExist) {
49 s.l.Infof("sudoers file not found: %v", err)
50 } else {
51 s.l.Errorf("failed to read sudoers file: %v", err)
52 }
53 return false
54 }
55 cmd := s.limaCmdCreator.CreateWithoutStdio("sudoers")
56 out, err := cmd.Output()
57 if err != nil {
58 s.l.Errorf("failed to run lima sudoers command: %v", err)
59 return false
60 }
61 return bytes.Equal(b, out)
62}
63
64// Install creates the sudoers file at `s.path()` with the contents of `lima sudoers`.
65func (s *sudoersFile) Install() error {

Callers

nothing calls this directly

Calls 5

pathMethod · 0.95
InfofMethod · 0.65
ErrorfMethod · 0.65
CreateWithoutStdioMethod · 0.65
OutputMethod · 0.65

Tested by

no test coverage detected