@@ -24,16 +24,15 @@ var (
2424)
2525
2626func init () {
27- _ , err := os .Stat ("/etc/pki/ca-trust/source/anchors/" )
28- if err == nil {
27+ if pathExists ("/etc/pki/ca-trust/source/anchors/" ) {
2928 SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem"
3029 SystemTrustCommand = []string {"update-ca-trust" , "extract" }
31- } else {
32- _ , err = os . Stat ( "/usr/local/share/ca-certificates/" )
33- if err == nil {
34- SystemTrustFilename = "/usr/local/share/ ca-certificates/mkcert-rootCA.crt"
35- SystemTrustCommand = [] string { "update- ca-certificates" }
36- }
30+ } else if pathExists ( "/usr/local/share/ca-certificates/" ) {
31+ SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt"
32+ SystemTrustCommand = [] string { "update-ca-certificates" }
33+ } else if pathExists ( "/etc/ ca-certificates/trust-source/anchors/" ) {
34+ SystemTrustFilename = "/etc/ ca-certificates/trust-source/anchors/mkcert-rootCA.crt"
35+ SystemTrustCommand = [] string { "trust" , "extract-compat" }
3736 }
3837 if SystemTrustCommand != nil {
3938 _ , err := exec .LookPath (SystemTrustCommand [0 ])
@@ -43,6 +42,11 @@ func init() {
4342 }
4443}
4544
45+ func pathExists (path string ) bool {
46+ _ , err := os .Stat (path )
47+ return err == nil
48+ }
49+
4650func (m * mkcert ) installPlatform () bool {
4751 if SystemTrustCommand == nil {
4852 log .Printf ("Installing to the system store is not yet supported on this Linux 😣 but %s will still work." , NSSBrowsers )
0 commit comments