[OpenWrt-Devel] [patch] [package] ca-certificates: create symbolic link for certificate hashes

Christian Schoenebeck christian.schoenebeck at gmail.com
Sat Jul 19 06:16:37 EDT 2014


From: Christian Schoenebeck <christian.schoenebeck at gmail.com>
Date: Sat, 19 Jul 2014 11:14:01 +0200
Subject: ca-certificates: create symbolic link for certificate hashes

Implementing "add-cert.sh" functionality discribed at
http://wiki.openwrt.org/doc/howto/wget-ssl-certs into Makefile 
otherwise you need to create symbolic links for certificate hashes yourself.

Signed-off-by: Christian Schoenebeck <christian.schoenebeck at gmail.com>
---
 package/system/ca-certificates/Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile
index 7f38c86..534c38b 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -34,6 +34,19 @@ endef
 define Package/ca-certificates/install
 	$(INSTALL_DIR) $(1)/etc/ssl/certs
 	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.crt $(1)/etc/ssl/certs/
+
+	OPENSSL=/usr/bin/openssl ; \
+	CERTDIR=$(1)/etc/ssl/certs ; \
+	if [ -f $$$$OPENSSL ]; then \
+		for CERTFILE in $$$$(ls -1 $$$$CERTDIR); do \
+			HASH=`$$$$OPENSSL x509 -hash -noout -in $$$$CERTDIR/$$$$CERTFILE` ; \
+			SUFFIX=0 ; \
+			while [ -h "$$$$CERTDIR/$$$$HASH.$$$$SUFFIX" ]; do \
+				let "SUFFIX += 1" ; \
+			done ; \
+			ln -s "$$$$CERTFILE" "$$$$CERTDIR/$$$$HASH.$$$$SUFFIX" ; \
+		done ; \
+	fi
 endef
 
 $(eval $(call BuildPackage,ca-certificates))
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list