Blame 0024-url-lib-module-setup.sh-install-ca-bundle.crt-by-lib.patch

Harald Hoyer e787af
From 1540df0e794d73442188667fa40622bdb6c591b5 Mon Sep 17 00:00:00 2001
Harald Hoyer e787af
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer e787af
Date: Thu, 11 Apr 2013 11:29:00 +0200
Harald Hoyer e787af
Subject: [PATCH] url-lib/module-setup.sh: install ca-bundle.crt by libcurl.so
Harald Hoyer e787af
Harald Hoyer e787af
https://bugzilla.redhat.com/show_bug.cgi?id=950770
Harald Hoyer e787af
Harald Hoyer e787af
curl seems to look for /etc/pki/tls/certs/ca-bundle.crt
Harald Hoyer e787af
Harald Hoyer e787af
extract the correct path by disecting libcurl.so
Harald Hoyer e787af
---
Harald Hoyer e787af
 modules.d/45url-lib/module-setup.sh | 19 +++++++++++++------
Harald Hoyer e787af
 1 file changed, 13 insertions(+), 6 deletions(-)
Harald Hoyer e787af
Harald Hoyer e787af
diff --git a/modules.d/45url-lib/module-setup.sh b/modules.d/45url-lib/module-setup.sh
Harald Hoyer e787af
index 0fb3667..e8b9700 100755
Harald Hoyer e787af
--- a/modules.d/45url-lib/module-setup.sh
Harald Hoyer e787af
+++ b/modules.d/45url-lib/module-setup.sh
Harald Hoyer e787af
@@ -12,6 +12,7 @@ depends() {
Harald Hoyer e787af
 }
Harald Hoyer e787af
 
Harald Hoyer e787af
 install() {
Harald Hoyer e787af
+    local _dir _crt _found
Harald Hoyer e787af
     inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
Harald Hoyer e787af
     dracut_install curl
Harald Hoyer e787af
     # also install libs for curl https
Harald Hoyer e787af
@@ -20,11 +21,17 @@ install() {
Harald Hoyer e787af
     inst_libdir_file "libsoftokn3.so*"
Harald Hoyer e787af
     inst_libdir_file "libsqlite3.so*"
Harald Hoyer e787af
 
Harald Hoyer e787af
-    mkdir -m 0755 -p "$initdir/etc/ssl/certs"
Harald Hoyer e787af
-    if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
Harald Hoyer e787af
-            /etc/ssl/certs/ca-bundle.crt \
Harald Hoyer e787af
-            /etc/ssl/certs/ca-certificates.crt; then
Harald Hoyer e787af
-        dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
Harald Hoyer e787af
-    fi
Harald Hoyer e787af
+    for _dir in $libdirs; do
Harald Hoyer e787af
+	    [[ -d $_dir ]] || continue
Harald Hoyer e787af
+            _crt=$(grep -F --binary-files=text -z .crt $_dir/libcurl.so)
Harald Hoyer e787af
+            [[ $_crt ]] || continue
Harald Hoyer e787af
+            [[ $_crt == /*/* ]] || continue
Harald Hoyer e787af
+            if ! inst_simple "$_crt"; then
Harald Hoyer e787af
+                dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
Harald Hoyer e787af
+                continue
Harald Hoyer e787af
+            fi
Harald Hoyer e787af
+            _found=1
Harald Hoyer e787af
+    done
Harald Hoyer e787af
+    [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
Harald Hoyer e787af
 }
Harald Hoyer e787af