inherit gnuconfig eutils DESCRIPTION="allows remote execution of commands by HTTPS magic cookies" SRC_URI="http://oss.linbit.com/${PN}/${P}.tar.gz" HOMEPAGE="http://oss.linbit.com/trapdoor2/" LICENSE="GPL-2" KEYWORDS="x86 ~amd64 ~ppc" IUSE="ssl tls" SLOT="0" RDEPEND="ssl? ( >=dev-libs/openssl-0.9.6b ) tls? ( >=net-libs/gnutls-1.0.0 ) net-misc/curl" src_compile() { if [ ! `use ssl` -a ! `use tls` ]; then einfo "trapdoor2 needs at least one of openssl or gnutls!" einfo "specify at least one of 'ssl' or 'tls' as USE flag" die fi gnuconfig_update econf `use_with ssl openssl` `use_with tls gnutls` || die emake || die } src_install() { make DESTDIR=${D} install || die dodoc README COPYING exeinto /etc/init.d newexe ${FILESDIR}/trapdoor2.rc6 trapdoor2 } pkg_postinst() { if [ ! -e /etc/td2/key.pem -a ! -e /etc/td2/cert.pem ]; then openssl genrsa -out ${ROOT}/etc/td2/key.pem 1024 openssl req -new -key ${ROOT}/etc/td2/key.pem -out ${ROOT}/etc/td2/cert.csr \ -batch openssl x509 -req -days 600 -in ${ROOT}/etc/td2/cert.csr -signkey \ ${ROOT}/etc/td2/key.pem -out ${ROOT}/etc/td2/cert.pem einfo "a sample self-signed key has been generated in" einfo "/etc/td2/key.pem and a corresponding certificate in" einfo "/etc/td2/cert.pem" einfo einfo "You may replace it with an own key/certificate pair and" einfo "portage will not touch it." fi }