Skip to content

Commit

Permalink
Print a message on -install if the CA is already installed
Browse files Browse the repository at this point in the history
Updates #182
  • Loading branch information
FiloSottile committed Aug 16, 2019
1 parent aa4dd61 commit 25b1d39
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,37 +242,43 @@ func getCAROOT() string {
}

func (m *mkcert) install() {
var printed bool
if storeEnabled("system") && !m.checkPlatform() {
if m.installPlatform() {
log.Print("The local CA is now installed in the system trust store! ⚡️")
if storeEnabled("system") {
if m.checkPlatform() {
log.Print("The local CA is already installed in the system trust store! 👍")
} else {
if m.installPlatform() {
log.Print("The local CA is now installed in the system trust store! ⚡️")
}
m.ignoreCheckFailure = true // TODO: replace with a check for a successful install
}
m.ignoreCheckFailure = true // TODO: replace with a check for a successful install
printed = true
}
if storeEnabled("nss") && hasNSS && !m.checkNSS() {
if hasCertutil && m.installNSS() {
log.Printf("The local CA is now installed in the %s trust store (requires browser restart)! 🦊", NSSBrowsers)
} else if CertutilInstallHelp == "" {
log.Printf(`Note: %s support is not available on your platform. ℹ️`, NSSBrowsers)
} else if !hasCertutil {
log.Printf(`Warning: "certutil" is not available, so the CA can't be automatically installed in %s! ⚠️`, NSSBrowsers)
log.Printf(`Install "certutil" with "%s" and re-run "mkcert -install" 👈`, CertutilInstallHelp)
if storeEnabled("nss") && hasNSS {
if m.checkNSS() {
log.Printf("The local CA is already installed in the %s trust store! 👍", NSSBrowsers)
} else {
if hasCertutil && m.installNSS() {
log.Printf("The local CA is now installed in the %s trust store (requires browser restart)! 🦊", NSSBrowsers)
} else if CertutilInstallHelp == "" {
log.Printf(`Note: %s support is not available on your platform. ℹ️`, NSSBrowsers)
} else if !hasCertutil {
log.Printf(`Warning: "certutil" is not available, so the CA can't be automatically installed in %s! ⚠️`, NSSBrowsers)
log.Printf(`Install "certutil" with "%s" and re-run "mkcert -install" 👈`, CertutilInstallHelp)
}
}
printed = true
}
if storeEnabled("java") && hasJava && !m.checkJava() {
if hasKeytool {
m.installJava()
log.Println("The local CA is now installed in Java's trust store! ☕️")
if storeEnabled("java") && hasJava {
if m.checkJava() {
log.Println("The local CA is already installed in Java's trust store! 👍")
} else {
log.Println(`Warning: "keytool" is not available, so the CA can't be automatically installed in Java's trust store! ⚠️`)
if hasKeytool {
m.installJava()
log.Println("The local CA is now installed in Java's trust store! ☕️")
} else {
log.Println(`Warning: "keytool" is not available, so the CA can't be automatically installed in Java's trust store! ⚠️`)
}
}
printed = true
}
if printed {
log.Print("")
}
log.Print("")
}

func (m *mkcert) uninstall() {
Expand Down

0 comments on commit 25b1d39

Please sign in to comment.