Skip to content

Commit 42ffd70

Browse files
committed
Merge the logic at master...eregon:openssl-linux
See: #1974 (review) master...eregon:openssl-linux rubygems/rubygems#2415 (comment)
1 parent 73d6da8 commit 42ffd70

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

bin/ruby-build

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,14 +1150,27 @@ build_package_openssl() {
11501150
local pem_file="$OPENSSLDIR/cert.pem"
11511151
security find-certificate -a -p /Library/Keychains/System.keychain > "$pem_file"
11521152
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file"
1153-
else
1153+
elif [ -e /etc/pki/tls/cert.pem ]; then # RedHat
1154+
# See https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259
1155+
rm -rf "$OPENSSLDIR/certs" "$pem_file"
1156+
ln -s /etc/pki/tls/certs "$OPENSSLDIR"
1157+
ln -s /etc/pki/tls/cert.pem "$pem_file"
1158+
elif [ -e /etc/ssl/certs/ca-certificates.crt ]; then # Debian
1159+
# See https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259
1160+
rm -rf "$OPENSSLDIR/certs" "$pem_file"
1161+
ln -s /etc/ssl/certs "$OPENSSLDIR"
1162+
ln -s /etc/ssl/certs/ca-certificates.crt "$pem_file"
1163+
elif type openssl &>/dev/null; then
11541164
# symlink to the system openssl certs
11551165
local SYSTEM_OPENSSLDIR
11561166
SYSTEM_OPENSSLDIR=$(openssl version -d | sed -e 's/.*: "//' -e 's/"$//' || true)
11571167
if [ -n "$SYSTEM_OPENSSLDIR" ]; then
11581168
ln -sf "$SYSTEM_OPENSSLDIR/cert.pem" "$OPENSSLDIR/cert.pem"
11591169
ln -snf "$SYSTEM_OPENSSLDIR/certs" "$OPENSSLDIR/certs"
11601170
fi
1171+
else
1172+
echo "Could not find OpenSSL certificates" >&2
1173+
exit 1
11611174
fi
11621175
}
11631176

0 commit comments

Comments
 (0)