libressl: postinstall code is mac-only (#72736)
parent
6018b79502
commit
06fbfba01d
|
@ -46,27 +46,29 @@ class Libressl < Formula
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_install
|
def post_install
|
||||||
keychains = %w[
|
on_macos do
|
||||||
/System/Library/Keychains/SystemRootCertificates.keychain
|
keychains = %w[
|
||||||
]
|
/System/Library/Keychains/SystemRootCertificates.keychain
|
||||||
|
]
|
||||||
|
|
||||||
certs_list = `security find-certificate -a -p #{keychains.join(" ")}`
|
certs_list = `security find-certificate -a -p #{keychains.join(" ")}`
|
||||||
certs = certs_list.scan(
|
certs = certs_list.scan(
|
||||||
/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m,
|
/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m,
|
||||||
)
|
)
|
||||||
|
|
||||||
valid_certs = certs.select do |cert|
|
valid_certs = certs.select do |cert|
|
||||||
IO.popen("#{bin}/openssl x509 -inform pem -checkend 0 -noout", "w") do |openssl_io|
|
IO.popen("#{bin}/openssl x509 -inform pem -checkend 0 -noout", "w") do |openssl_io|
|
||||||
openssl_io.write(cert)
|
openssl_io.write(cert)
|
||||||
openssl_io.close_write
|
openssl_io.close_write
|
||||||
|
end
|
||||||
|
|
||||||
|
$CHILD_STATUS.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
$CHILD_STATUS.success?
|
# LibreSSL install a default pem - We prefer to use macOS for consistency.
|
||||||
|
rm_f %W[#{etc}/libressl/cert.pem #{etc}/libressl/cert.pem.default]
|
||||||
|
(etc/"libressl/cert.pem").atomic_write(valid_certs.join("\n"))
|
||||||
end
|
end
|
||||||
|
|
||||||
# LibreSSL install a default pem - We prefer to use macOS for consistency.
|
|
||||||
rm_f %W[#{etc}/libressl/cert.pem #{etc}/libressl/cert.pem.default]
|
|
||||||
(etc/"libressl/cert.pem").atomic_write(valid_certs.join("\n"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def caveats
|
def caveats
|
||||||
|
|
Loading…
Reference in New Issue