aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorJack Nagel2013-07-13 19:16:31 -0500
committerJack Nagel2013-07-13 19:16:33 -0500
commit0a5b4375c9fcd32b0dc29e41456e7001ff923d25 (patch)
tree1812179c4e0edca79b3b6816bf7a79005c3a9901 /Library/Formula
parent1235272296a4eeca71c3bef77a56be6d75935f17 (diff)
downloadhomebrew-0a5b4375c9fcd32b0dc29e41456e7001ff923d25.tar.bz2
openssl: create a cert.pem file from keychain certs
Closes #21065.
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/openssl.rb33
1 files changed, 28 insertions, 5 deletions
diff --git a/Library/Formula/openssl.rb b/Library/Formula/openssl.rb
index 1fbfd9fb7..565c23360 100644
--- a/Library/Formula/openssl.rb
+++ b/Library/Formula/openssl.rb
@@ -12,7 +12,7 @@ class Openssl < Formula
def install
args = %W[./Configure
--prefix=#{prefix}
- --openssldir=#{etc}/openssl
+ --openssldir=#{openssldir}
zlib-dynamic
shared
]
@@ -31,10 +31,33 @@ class Openssl < Formula
system "make", "install", "MANDIR=#{man}", "MANSUFFIX=ssl"
end
- def caveats; <<-EOS.undent
- To install updated CA certs from Mozilla.org:
+ def openssldir
+ etc/"openssl"
+ end
+
+ def cert_pem
+ openssldir/"cert.pem"
+ end
+
+ def osx_cert_pem
+ openssldir/"osx_cert.pem"
+ end
- brew install curl-ca-bundle
- EOS
+ def write_pem_file
+ system "security find-certificate -a -p /Library/Keychains/System.keychain > '#{osx_cert_pem}.tmp'"
+ system "security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> '#{osx_cert_pem}.tmp'"
+ system "mv", "-f", "#{osx_cert_pem}.tmp", osx_cert_pem
+ end
+
+ def post_install
+ openssldir.mkpath
+
+ if cert_pem.exist?
+ write_pem_file
+ else
+ cert_pem.unlink if cert_pem.symlink?
+ write_pem_file
+ openssldir.install_symlink 'osx_cert.pem' => 'cert.pem'
+ end
end
end