mirror of
https://github.com/FiloSottile/mkcert.git
synced 2025-10-13 16:31:41 +08:00
Support installing to system trust store for Arch-based distros (#57)
This commit is contained in:

committed by
Filippo Valsorda

parent
047acfafed
commit
281c560e4a
@@ -24,16 +24,15 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, err := os.Stat("/etc/pki/ca-trust/source/anchors/")
|
||||
if err == nil {
|
||||
if pathExists("/etc/pki/ca-trust/source/anchors/") {
|
||||
SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem"
|
||||
SystemTrustCommand = []string{"update-ca-trust", "extract"}
|
||||
} else {
|
||||
_, err = os.Stat("/usr/local/share/ca-certificates/")
|
||||
if err == nil {
|
||||
SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt"
|
||||
SystemTrustCommand = []string{"update-ca-certificates"}
|
||||
}
|
||||
} else if pathExists("/usr/local/share/ca-certificates/") {
|
||||
SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt"
|
||||
SystemTrustCommand = []string{"update-ca-certificates"}
|
||||
} else if pathExists("/etc/ca-certificates/trust-source/anchors/") {
|
||||
SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt"
|
||||
SystemTrustCommand = []string{"trust", "extract-compat"}
|
||||
}
|
||||
if SystemTrustCommand != nil {
|
||||
_, err := exec.LookPath(SystemTrustCommand[0])
|
||||
@@ -43,6 +42,11 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func pathExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (m *mkcert) installPlatform() bool {
|
||||
if SystemTrustCommand == nil {
|
||||
log.Printf("Installing to the system store is not yet supported on this Linux 😣 but %s will still work.", NSSBrowsers)
|
||||
|
Reference in New Issue
Block a user