From 4b74af3a1a584a48b2aa6cb866137e2509a89706 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 23 Sep 2014 00:04:27 +0000
Subject: ca-certificates: update

---
 abs/core/ca-certificates/PKGBUILD                  | 76 +++++++++++++---------
 .../ca-certificates/ca-certificates-utils.install  | 29 +++++++++
 abs/core/ca-certificates/ca-certificates.install   | 23 -------
 3 files changed, 74 insertions(+), 54 deletions(-)
 create mode 100644 abs/core/ca-certificates/ca-certificates-utils.install
 delete mode 100644 abs/core/ca-certificates/ca-certificates.install

diff --git a/abs/core/ca-certificates/PKGBUILD b/abs/core/ca-certificates/PKGBUILD
index 3c293a7..a5edf22 100644
--- a/abs/core/ca-certificates/PKGBUILD
+++ b/abs/core/ca-certificates/PKGBUILD
@@ -1,43 +1,57 @@
 # $Id$
 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
 
-pkgname=ca-certificates
-pkgver=20140325
-pkgrel=1
+pkgbase=ca-certificates
+pkgname=(ca-certificates-utils ca-certificates)
+pkgver=20140923
+pkgrel=2
 pkgdesc='Common CA certificates'
 arch=('any')
-url='http://packages.qa.debian.org/c/ca-certificates.html'
-license=('MPL' 'GPL')
-source=("http://ftp.debian.org/debian/pool/main/c/${pkgname}/${pkgname}_${pkgver}.tar.xz")
-depends=('bash' 'run-parts' 'openssl' 'findutils' 'coreutils' 'sed')
-makedepends=('python2')
-install='ca-certificates.install'
-backup=('etc/ca-certificates.conf')
-sha256sums=('c0e3d8c517995db2737f7f1a9b69d654b8823fa6d337871c6ce111fcf083454a')
+url='http://pkgs.fedoraproject.org/cgit/ca-certificates.git'
+license=('GPL2')
+depends=('sh' 'p11-kit')
+makedepends=('asciidoc')
+_commit=f81c301
+source=("update-ca-trust::$url/plain/update-ca-trust?id=$_commit"
+        "update-ca-trust.8.txt::$url/plain/update-ca-trust.8.txt?id=$_commit")
+sha256sums=('75ef2f4b0fddd2ca3c69b234a6abb66fd732e4af96814b65dcedb0dd52018381'
+            'd31ac2bb5f1941aea0ac1e51861af7be224b6bb85820e30bb30793112aa785ba')
+
+_confdir=/etc/$pkgbase
+_datadir=/usr/share/$pkgbase
 
 prepare() {
-	cd ${srcdir}/${pkgname}
-	sed 's|/usr/bin/python|/usr/bin/python2|g' -i mozilla/certdata2pem.py
-	sed 's|python|python2|g' -i mozilla/Makefile
+	sed -i "s:/etc/pki/ca-trust:${_confdir}:g" update-ca-trust
 }
 
-build() {
-	cd ${srcdir}/${pkgname}
-	make SUBDIRS=mozilla
+package_ca-certificates-utils() {
+	pkgdesc+=" (utilities)"
+	install=ca-certificates-utils.install
+	provides=(ca-certificates ca-certificates-java)
+	conflicts=(ca-certificates-java)
+	replaces=(ca-certificates-java)
+
+	asciidoc.py -v -d manpage -b docbook update-ca-trust.8.txt
+	xsltproc --nonet -o update-ca-trust.8 /etc/asciidoc/docbook-xsl/manpage.xsl update-ca-trust.8.xml
+
+	install -D update-ca-trust "${pkgdir}/usr/bin/update-ca-trust"
+	install -Dm644 update-ca-trust.8 "${pkgdir}/usr/share/man/man8/update-ca-trust.8"
+
+	install -d "${pkgdir}"{${_confdir},${_datadir}}/trust-source/{anchors,blacklist}
+
+	_extractdir="${pkgdir}${_confdir}/extracted"
+	_ssldir="${pkgdir}/etc/ssl"
+
+	install -d "${_ssldir}/certs/java" "${_extractdir}"/{openssl,pem,java}
+	ln -sr "${_extractdir}/openssl/ca-bundle.trust.crt" "${_ssldir}/certs/ca-bundle.trust.crt"
+	ln -sr "${_extractdir}/pem/tls-ca-bundle.pem" "${_ssldir}/certs/ca-bundle.crt"
+	ln -sr "${_extractdir}/pem/tls-ca-bundle.pem" "${_ssldir}/cert.pem"
+	ln -sr "${_extractdir}/java/cacerts" "${_ssldir}/certs/java/cacerts"
 }
 
-package() {
-	cd ${srcdir}/${pkgname}
-	install -d -m755 ${pkgdir}/{etc/ca-certificates/update.d,usr/{sbin,share/ca-certificates},etc/ssl/certs}
-	make install SUBDIRS=mozilla DESTDIR=${pkgdir}
-	mv ${pkgdir}/usr/sbin ${pkgdir}/usr/bin
-	install -D -m644 sbin/update-ca-certificates.8 ${pkgdir}/usr/share/man/man8/update-ca-certificates.8
-
-	(
-	echo "# Automatically generated by ${pkgname}-${pkgver}-${pkgrel}"
-	echo "# see update-ca-certificates man page"
-	echo "# "
-	cd ${pkgdir}/usr/share/ca-certificates
-	find . -name '*.crt' | sort | cut -b3-
-	) > ${pkgdir}/etc/ca-certificates.conf
+package_ca-certificates() {
+	pkgdesc+=" (default providers)"
+	depends=(ca-certificates-{mozilla,cacert})
 }
+
+# vim:set noet ts=8 sw=8:
diff --git a/abs/core/ca-certificates/ca-certificates-utils.install b/abs/core/ca-certificates/ca-certificates-utils.install
new file mode 100644
index 0000000..bf18c7f
--- /dev/null
+++ b/abs/core/ca-certificates/ca-certificates-utils.install
@@ -0,0 +1,29 @@
+export LC_ALL=C
+
+post_install() {
+	usr/bin/update-ca-trust
+}
+
+pre_upgrade() {
+	if (( $(vercmp $2 20140923-2) < 0 )); then
+		find /etc/ssl/certs -type l -print | while read symlink; do
+			case $(readlink $symlink) in
+			/usr/share/ca-certificates*) rm -f $symlink;;
+			esac
+		done
+		find /etc/ssl/certs -type l -print | while read symlink; do
+			test -f $symlink || rm -f $symlink
+		done
+		rm -f /etc/ssl/certs/ca-certificates.crt
+	fi
+}
+
+post_upgrade() {
+	usr/bin/update-ca-trust
+}
+
+pre_remove() {
+	usr/bin/update-ca-trust
+}
+
+# vim:set noet ts=8 sw=8:
diff --git a/abs/core/ca-certificates/ca-certificates.install b/abs/core/ca-certificates/ca-certificates.install
deleted file mode 100644
index cbd88e6..0000000
--- a/abs/core/ca-certificates/ca-certificates.install
+++ /dev/null
@@ -1,23 +0,0 @@
-export LC_ALL=C
-
-post_install() {
-	usr/bin/update-ca-certificates --fresh >/dev/null 2>&1
-}
-
-post_upgrade() {
-	usr/bin/update-ca-certificates --fresh >/dev/null 2>&1
-}
-
-pre_remove() {
-	# clean up certificates
-	local _backup=$(mktemp)
-	mv etc/ca-certificates.conf ${_backup}
-	echo > etc/ca-certificates.conf
-	usr/bin/update-ca-certificates --fresh >/dev/null 2>&1
-	mv ${_backup} etc/ca-certificates.conf
-}
-
-post_remove() {
-	# remove the cert file if it is empty
-	[[ -s etc/ssl/certs/ca-certificates.crt ]] || rm -f etc/ssl/certs/ca-certificates.crt
-}
-- 
cgit v0.12

