| 1 |
# Copyright 1999-2012 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-20111025.ebuild,v 1.10 2012/04/26 13:57:53 aballier 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 |
#NMU_PR="1"
|
| 12 |
SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb"
|
| 13 |
|
| 14 |
LICENSE="MPL-1.1"
|
| 15 |
SLOT="0"
|
| 16 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~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"
|
| 17 |
IUSE=""
|
| 18 |
|
| 19 |
# platforms like AIX don't have a good ar
|
| 20 |
DEPEND="kernel_AIX? ( app-arch/deb2targz )
|
| 21 |
!<sys-apps/portage-2.1.10.41"
|
| 22 |
# openssl: we run `c_rehash`
|
| 23 |
# debianutils: we run `run-parts`
|
| 24 |
RDEPEND="${DEPEND}
|
| 25 |
dev-libs/openssl
|
| 26 |
sys-apps/debianutils"
|
| 27 |
|
| 28 |
S=${WORKDIR}
|
| 29 |
|
| 30 |
pkg_setup() {
|
| 31 |
# For the conversion to having it in CONFIG_PROTECT_MASK,
|
| 32 |
# we need to tell users about it once manually first.
|
| 33 |
[[ -f "${EPREFIX}"/etc/env.d/98ca-certificates ]] \
|
| 34 |
|| ewarn "You should run update-ca-certificates manually after etc-update"
|
| 35 |
}
|
| 36 |
|
| 37 |
src_unpack() {
|
| 38 |
if [[ -n ${EPREFIX} ]] ; then
|
| 39 |
# need to perform everything in the offset, #381937
|
| 40 |
mkdir -p "./${EPREFIX}"
|
| 41 |
cd "./${EPREFIX}" || die
|
| 42 |
fi
|
| 43 |
unpack ${A}
|
| 44 |
unpack ./data.tar.gz
|
| 45 |
rm -f control.tar.gz data.tar.gz debian-binary
|
| 46 |
}
|
| 47 |
|
| 48 |
src_prepare() {
|
| 49 |
cd "./${EPREFIX}" || die
|
| 50 |
epatch "${FILESDIR}"/${PN}-20110502-root.patch
|
| 51 |
local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g')
|
| 52 |
sed -i \
|
| 53 |
-e '/="$ROOT/s:ROOT/:ROOT'"${EPREFIX}"'/:' \
|
| 54 |
-e '/RELPATH="\.\./s:"$:'"${relp}"'":' \
|
| 55 |
usr/sbin/update-ca-certificates || die
|
| 56 |
}
|
| 57 |
|
| 58 |
src_compile() {
|
| 59 |
(
|
| 60 |
echo "# Automatically generated by ${CATEGORY}/${PF}"
|
| 61 |
echo "# $(date -u)"
|
| 62 |
echo "# Do not edit."
|
| 63 |
cd "${S}${EPREFIX}"/usr/share/ca-certificates
|
| 64 |
find * -name '*.crt' | LC_ALL=C sort
|
| 65 |
) > "${S}${EPREFIX}"/etc/ca-certificates.conf
|
| 66 |
|
| 67 |
sh "${S}${EPREFIX}"/usr/sbin/update-ca-certificates --root "${S}" || die
|
| 68 |
}
|
| 69 |
|
| 70 |
src_install() {
|
| 71 |
cp -pPR * "${D}"/ || die
|
| 72 |
|
| 73 |
mv "${ED}"/usr/share/doc/{ca-certificates,${PF}} || die
|
| 74 |
prepalldocs
|
| 75 |
|
| 76 |
echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates
|
| 77 |
doenvd 98ca-certificates
|
| 78 |
}
|
| 79 |
|
| 80 |
pkg_postinst() {
|
| 81 |
if [ -d "${EROOT}/usr/local/share/ca-certificates" ] ; then
|
| 82 |
# if the user has local certs, we need to rebuild again
|
| 83 |
# to include their stuff in the db.
|
| 84 |
# However it's too overzealous when the user has custom certs in place.
|
| 85 |
# --fresh is to clean up dangling symlinks
|
| 86 |
"${EROOT}"/usr/sbin/update-ca-certificates --root "${EROOT}"
|
| 87 |
fi
|
| 88 |
|
| 89 |
local c badcerts=0
|
| 90 |
for c in $(find -L "${EROOT}"etc/ssl/certs/ -type l) ; do
|
| 91 |
ewarn "Broken symlink for a certificate at $c"
|
| 92 |
badcerts=1
|
| 93 |
done
|
| 94 |
if [ $badcerts -eq 1 ]; then
|
| 95 |
ewarn "You MUST remove the above broken symlinks"
|
| 96 |
ewarn "Otherwise any SSL validation that use the directory may fail!"
|
| 97 |
ewarn "To batch-remove them, run:"
|
| 98 |
ewarn "find -L ${EROOT}etc/ssl/certs/ -type l -exec rm {} +"
|
| 99 |
fi
|
| 100 |
}
|