Blob Blame History Raw
From 1540df0e794d73442188667fa40622bdb6c591b5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 11 Apr 2013 11:29:00 +0200
Subject: [PATCH] url-lib/module-setup.sh: install ca-bundle.crt by libcurl.so

https://bugzilla.redhat.com/show_bug.cgi?id=950770

curl seems to look for /etc/pki/tls/certs/ca-bundle.crt

extract the correct path by disecting libcurl.so
---
 modules.d/45url-lib/module-setup.sh | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/modules.d/45url-lib/module-setup.sh b/modules.d/45url-lib/module-setup.sh
index 0fb3667..e8b9700 100755
--- a/modules.d/45url-lib/module-setup.sh
+++ b/modules.d/45url-lib/module-setup.sh
@@ -12,6 +12,7 @@ depends() {
 }
 
 install() {
+    local _dir _crt _found
     inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
     dracut_install curl
     # also install libs for curl https
@@ -20,11 +21,17 @@ install() {
     inst_libdir_file "libsoftokn3.so*"
     inst_libdir_file "libsqlite3.so*"
 
-    mkdir -m 0755 -p "$initdir/etc/ssl/certs"
-    if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
-            /etc/ssl/certs/ca-bundle.crt \
-            /etc/ssl/certs/ca-certificates.crt; then
-        dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
-    fi
+    for _dir in $libdirs; do
+	    [[ -d $_dir ]] || continue
+            _crt=$(grep -F --binary-files=text -z .crt $_dir/libcurl.so)
+            [[ $_crt ]] || continue
+            [[ $_crt == /*/* ]] || continue
+            if ! inst_simple "$_crt"; then
+                dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
+                continue
+            fi
+            _found=1
+    done
+    [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
 }