# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" WANT_AUTOCONF="2.5" inherit eutils multilib autotools WEBAPP_MANUAL_SLOT="yes" #WEBAPP_DEPEN="dev-lang/perl" DESCRIPTION="Open Source out-of-the-box Certification Authority system" HOMEPAGE="http://www.openca.org/" SRC_URI="mirror://sourceforge/openca/${P}.tar.gz" LICENSE="OpenCA" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="dbm mysql +postgres ldap sasl install-offline install-online install-ext scep db2" COMMON_DEP="!app-crypt/openca dev-libs/openssl www-servers/apache:2[ssl] ldap? ( ( || ( net-nds/openldap ) ( net-nds/389-ds-base ) ) >=dev-perl/perl-ldap-0.28 >=dev-perl/IO-Socket-SSL-0.92 >=dev-perl/URI-1.23 ) app-misc/openca-tools virtual/mta mysql? ( dev-perl/DBD-mysql ) postgres? ( dev-perl/DBD-Pg ) dbm? ( perl-core/DB_File ) sasl? ( dev-perl/Authen-SASL ) >=dev-lang/perl-5.8 dev-perl/Digest-HMAC virtual/perl-Digest-SHA virtual/perl-Digest-MD5 dev-perl/libintl-perl dev-perl/IO-stringy dev-perl/MIME-Lite dev-perl/MIME-tools dev-perl/MailTools dev-perl/Parse-RecDescent dev-perl/X500-DN dev-perl/XML-Twig dev-perl/CGI-Session dev-perl/net-server dev-perl/Convert-ASN1 dev-perl/Bit-Vector =dev-perl/OpenCA-AC-1.15 =dev-perl/OpenCA-CRL-1.6 =dev-perl/OpenCA-CRR-0.0.2 =dev-perl/OpenCA-Configuration-1.5.3 =dev-perl/OpenCA-Crypto-1.1.1.1 =dev-perl/OpenCA-DBI-1.47 =dev-perl/OpenCA-Log-0.9.4 =dev-perl/OpenCA-LDAP-1.1.1.1 =dev-perl/OpenCA-OpenSSL-1.31 =dev-perl/OpenCA-PKCS7-0.9 =dev-perl/OpenCA-REQ-1.6 =dev-perl/OpenCA-Session-0.9 =dev-perl/OpenCA-StateMachine-0.9 =dev-perl/OpenCA-TRIStateCGI-1.5.5-r1 =dev-perl/OpenCA-Tools-0.9-r1 =dev-perl/OpenCA-UI-HTML-0.9 =dev-perl/OpenCA-User-1.5 =dev-perl/OpenCA-X509-1.10 =dev-perl/OpenCA-XML-Cache-0.9.3" DEPEND="${COMMON_DEP} sys-devel/libtool dev-util/pkgconfig" RDEPEND="${COMMON_DEP}" src_prepare() { epatch "${FILESDIR}"/gentoofu_configure.in.patch epatch "${FILESDIR}"/initServer-1.1.1.patch epatch "${FILESDIR}"/configure-disable-version-check.patch eaclocal eautoconf } src_configure() { einfo "Configuring ${P}" myconf=" \ --with-openca-prefix=/usr \ --with-openca-user=openca \ --with-openca-group=openca \ --with-htdocs-fs-prefix=/var/www/localhost/htdocs \ --with-cgi-fs-prefix=/var/www/localhost/cgi-bin \ --with-htdocs-url-prefix= \ --with-cgi-url-prefix=/cgi-bin \ --with-etc-prefix=/etc/openca \ --with-var-prefix=/var/lib/openca \ --with-lib-prefix=/usr/$(get_libdir)/openca \ --with-web-host=localhost \ --with-httpd-user=apache \ --with-httpd-group=apache \ --enable-maintainer-mode \ --disable-external-modules \ --disable-package-build \ --with-dist-user=portage \ --with-dist-group=portage \ --with-sendmail=/usr/bin/sendmail \ --with-module-prefix=/usr/$(get_libdir) \ --with-service-mail-account=openca@localhost \ --with-cert-chars=UTF8 \ --with-auth-user=admin \ --with-auth-password=gentoo" if use mysql; then myconf="${myconf} --with-db-type=mysql \ --with-db-name=openca \ --with-db-host=localhost \ --with-db-port=3306 \ --with-db-user=openca \ --with-db-passwd=openca" fi if use postgres; then myconf="${myconf} --with-db-type=Pg \ --with-db-name=openca \ --with-db-host=localhost \ --with-db-port=5432 \ --with-db-user=openca \ --with-db-passwd=openca" fi use scep && myconf+=" --enable-scep " econf ${myconf} || die "econf failed" #Disable Perl Module Build ; Use system modules cp "${FILESDIR}"/Makefile.perl-disable-1.0.2 "${S}"/src/ext-modules/Makefile || die cp "${FILESDIR}"/Makefile.perl-disable-1.0.2 "${S}"/src/modules/Makefile || die } src_install () { if use install-offline; then make DEST_DIR="${D}" install-offline ||die "install CA failed" fi if use install-online; then make DEST_DIR="${D}" install-online ||die "install failed" fi if use install-ext;then make DEST_DIR="${D}" install-ext ||die "install failed" fi rm -fr "${D}"/usr/etc || die newinitd ${FILESDIR}/openca.init openca newconfd ${FILESDIR}/openca.conf openca if use ldap; then insinto /etc/openldap/schema/ doins contrib/openldap/openca.schema fi dodoc ChangeLog INSTALL I18N NOTES.Chain README STATUS THANKS dodoc docs/HISTORY doman docs/man3/base.3 } pkg_postinst() { elog elog "Following is to do to get a working system:" elog "1. If this is the first installation please do a" elog " emerge --config openca-base" elog elog " This will setup a web password for the admin" elog " user and update dynamic parts of the configuation" elog elog "2. Allocate a database and create a user account on" elog " it which is allowed to create the reqired tables" elog elog "3. Please check file '/etc/openca/config.xml'" elog " Especially configure the database access info" elog elog "If you use apache web server," elog " it's highly recommended to use SuExec feature" elog "to work with different user permissions" } pkg_setup() { enewgroup openca enewuser openca -1 -1 /dev/null openca } pkg_config() { local ret=`grep "@default_web_password@" "/etc/openca/config.xml"` if ! [ "x$ret" = "x" ] ; then einfo "Provide the default password for the web interface:" read pwd /usr/bin/openca-setpasswd $pwd fi /bin/sh /etc/openca/configure_etc.sh }