From 61180c71ad97395b97b0a54a0d90df81206fc9c4 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 12 Aug 2018 21:11:34 -0400 Subject: [PATCH] Add support for Firefox Developer Edition This also fixes a bug where we wouldn't install to Chrome on Linux if Firefox wasn't also present. Closes #48 Updates #51 --- truststore_darwin.go | 1 - truststore_linux.go | 1 - truststore_nss.go | 13 ++++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/truststore_darwin.go b/truststore_darwin.go index 46a5a73..4556813 100644 --- a/truststore_darwin.go +++ b/truststore_darwin.go @@ -17,7 +17,6 @@ import ( ) var ( - FirefoxPath = "/Applications/Firefox.app" FirefoxProfile = os.Getenv("HOME") + "/Library/Application Support/Firefox/Profiles/*" CertutilInstallHelp = "brew install nss" NSSBrowsers = "Firefox" diff --git a/truststore_linux.go b/truststore_linux.go index 64757a9..8cbb9ad 100644 --- a/truststore_linux.go +++ b/truststore_linux.go @@ -15,7 +15,6 @@ import ( ) var ( - FirefoxPath = "/usr/bin/firefox" FirefoxProfile = os.Getenv("HOME") + "/.mozilla/firefox/*" CertutilInstallHelp = `apt install libnss3-tools" or "yum install nss-tools` NSSBrowsers = "Firefox and/or Chrome/Chromium" diff --git a/truststore_nss.go b/truststore_nss.go index cf2810f..666928a 100644 --- a/truststore_nss.go +++ b/truststore_nss.go @@ -17,8 +17,13 @@ var ( ) func init() { - _, err := os.Stat(FirefoxPath) - hasNSS = !os.IsNotExist(err) + for _, path := range []string{ + "/usr/bin/firefox", nssDB, "/Applications/Firefox.app", + "/Applications/Firefox Developer Edition.app", + } { + _, err := os.Stat(path) + hasNSS = hasNSS || !os.IsNotExist(err) + } switch runtime.GOOS { case "darwin": @@ -32,9 +37,7 @@ func init() { hasCertutil = !os.IsNotExist(err) case "linux": - _, err := os.Stat(nssDB) - hasNSS = hasNSS && !os.IsNotExist(err) - + var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil }