MCPcopy
hub / github.com/FiloSottile/mkcert / installPlatform

Method installPlatform

truststore_linux.go:55–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55func (m *mkcert) installPlatform() bool {
56 if SystemTrustCommand == nil {
57 log.Printf("Installing to the system store is not yet supported on this Linux 😣 but %s will still work.", NSSBrowsers)
58 log.Printf("You can also manually install the root certificate at %q.", filepath.Join(m.CAROOT, rootName))
59 return false
60 }
61
62 cert, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName))
63 fatalIfErr(err, "failed to read root certificate")
64
65 cmd := commandWithSudo("tee", m.systemTrustFilename())
66 cmd.Stdin = bytes.NewReader(cert)
67 out, err := cmd.CombinedOutput()
68 fatalIfCmdErr(err, "tee", out)
69
70 cmd = commandWithSudo(SystemTrustCommand...)
71 out, err = cmd.CombinedOutput()
72 fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out)
73
74 return true
75}
76
77func (m *mkcert) uninstallPlatform() bool {
78 if SystemTrustCommand == nil {

Callers 1

installMethod · 0.95

Calls 4

systemTrustFilenameMethod · 0.95
fatalIfErrFunction · 0.85
commandWithSudoFunction · 0.85
fatalIfCmdErrFunction · 0.85

Tested by

no test coverage detected