| 1 |
# Copyright 1999-2011 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-misc/ca-certificates/ca-certificates-20110502-r2.ebuild,v 1.2 2011/09/02 19:08:32 darkside Exp $ |
| 4 |
|
| 5 |
EAPI="3" |
| 6 |
|
| 7 |
inherit eutils |
| 8 |
|
| 9 |
DESCRIPTION="Common CA Certificates PEM files" |
| 10 |
HOMEPAGE="http://packages.debian.org/sid/ca-certificates" |
| 11 |
SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}+nmu1_all.deb" |
| 12 |
|
| 13 |
LICENSE="MPL-1.1" |
| 14 |
SLOT="0" |
| 15 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" |
| 16 |
IUSE="" |
| 17 |
|
| 18 |
DEPEND="|| ( >=sys-apps/coreutils-6.10-r1 sys-apps/mktemp sys-freebsd/freebsd-ubin )" |
| 19 |
RDEPEND="${DEPEND} |
| 20 |
dev-libs/openssl |
| 21 |
sys-apps/debianutils |
| 22 |
kernel_AIX? ( app-arch/deb2targz )" # platforms like AIX don't have a good ar |
| 23 |
|
| 24 |
S=${WORKDIR} |
| 25 |
|
| 26 |
pkg_setup() { |
| 27 |
# For the conversion to having it in CONFIG_PROTECT_MASK, |
| 28 |
# we need to tell users about it once manually first. |
| 29 |
[[ -f "${EPREFIX}"/etc/env.d/98ca-certificates ]] \ |
| 30 |
|| ewarn "You should run update-ca-certificates manually after etc-update" |
| 31 |
} |
| 32 |
|
| 33 |
src_unpack() { |
| 34 |
unpack ${A} |
| 35 |
unpack ./data.tar.gz |
| 36 |
rm -f control.tar.gz data.tar.gz debian-binary |
| 37 |
} |
| 38 |
|
| 39 |
src_prepare() { |
| 40 |
epatch "${FILESDIR}"/${PN}-20090709-root.patch |
| 41 |
} |
| 42 |
|
| 43 |
src_compile() { |
| 44 |
( |
| 45 |
echo "# Automatically generated by ${CATEGORY}/${PF}" |
| 46 |
echo "# $(date -u)" |
| 47 |
echo "# Do not edit." |
| 48 |
cd "${S}"/usr/share/ca-certificates |
| 49 |
find * -name '*.crt' | LC_ALL=C sort |
| 50 |
) > "${S}"/etc/ca-certificates.conf |
| 51 |
|
| 52 |
sed -i "/^ROOT=""/s:=.*:='${EPREFIX}':" "${S}"/usr/sbin/update-ca-certificates || die |
| 53 |
"${S}"/usr/sbin/update-ca-certificates --root "${S}" |
| 54 |
} |
| 55 |
|
| 56 |
src_install() { |
| 57 |
mkdir -p "${ED}" |
| 58 |
cp -pPR * "${ED}"/ || die |
| 59 |
|
| 60 |
mv "${ED}"/usr/share/doc/{ca-certificates,${PF}} || die |
| 61 |
prepalldocs |
| 62 |
|
| 63 |
echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates |
| 64 |
doenvd 98ca-certificates |
| 65 |
} |
| 66 |
|
| 67 |
pkg_postinst() { |
| 68 |
if [ -d "${EROOT}/usr/local/share/ca-certificates" ] ; then |
| 69 |
# if the user has local certs, we need to rebuild again |
| 70 |
# to include their stuff in the db. |
| 71 |
# However it's too overzealous when the user has custom certs in place. |
| 72 |
# --fresh is to clean up dangling symlinks |
| 73 |
"${EROOT}"/usr/sbin/update-ca-certificates --root "${EROOT}" |
| 74 |
fi |
| 75 |
|
| 76 |
local c badcerts=0 |
| 77 |
for c in $(find -L "${EROOT}"etc/ssl/certs/ -type l) ; do |
| 78 |
ewarn "Broken symlink for a certificate at $c" |
| 79 |
badcerts=1 |
| 80 |
done |
| 81 |
if [ $badcerts -eq 1 ]; then |
| 82 |
ewarn "You MUST remove the above broken symlinks" |
| 83 |
ewarn "Otherwise any SSL validation that use the directory may fail!" |
| 84 |
ewarn "To batch-remove them, run:" |
| 85 |
ewarn "find -L ${EROOT}etc/ssl/certs/ -type l -exec rm {} +" |
| 86 |
fi |
| 87 |
} |