# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="4" inherit user eutils java-pkg-2 java-ant-2 pax-utils DESCRIPTION="I2P is an anonymous network." SRC_URI="http://mirror.i2p2.de/${PN}source_${PV}.tar.bz2" HOMEPAGE="http://www.i2p2.de/" SLOT="0" KEYWORDS="~x86 ~amd64" LICENSE="GPL-2" IUSE="initscript" DEPEND=">=virtual/jdk-1.5" RDEPEND="${DEPEND}" QA_TEXTRELS="opt/i2p/i2psvc" QA_TEXTRELS="opt/i2p/lib/libwrapper.so" pkg_setup() { if use initscript; then enewgroup ${PN} enewuser ${PN} -1 -1 /var/lib/i2p ${PN} -m fi } src_compile() { echo "noExe=true" >> build.properties; eant pkg || die } src_install() { cd pkg-temp || die sed -i '/appropriate\ paths/a\ USER_HOME="$HOME"\ SYSTEM_java_io_tmpdir="$USER_HOME/.i2p"' \ i2prouter || die sed -i "/appropriate\ paths/a\ INSTALL_PATH=\"${EROOT}opt/i2p\""\ i2prouter || die sed -i 's:%USER_HOME:$USER_HOME:g' \ i2prouter || die sed -i 's:%INSTALL_PATH:$INSTALL_PATH:g' \ eepget i2prouter runplain.sh || die sed -i 's:%SYSTEM_java_io_tmpdir:$SYSTEM_java_io_tmpdir:g' \ i2prouter runplain.sh|| die sed -i s:'$INSTALL_PATH':"${EROOT}opt/i2p":g \ wrapper.config || die exeinto /opt/i2p insinto /opt/i2p # Install to package root # Install files doins "${S}"/apps/i2psnark/jetty-i2psnark.xml "${S}"/pkg-temp/blocklist.txt "${S}"/apps/i2psnark/launch-i2psnark "${S}"/pkg-temp/hosts.txt || die doexe eepget i2prouter "${S}"/apps/i2psnark/launch-i2psnark osid postinstall.sh runplain.sh *.config || die if use x86; then doexe lib/wrapper/linux/i2psvc || die elif use amd64; then doexe lib/wrapper/linux64/i2psvc || die fi dodoc history.txt LICENSE.txt INSTALL-headless.txt || die doman man/* || die # Install dirs doins -r docs geoip eepsite scripts certificates webapps || die dodoc -r licenses || die # Install files to package lib insinto /opt/i2p/lib exeinto /opt/i2p/lib local i for i in lib/*; do if [ -f "${i}" ] && [[ ! "${i}" =~ ".dll" ]]; then doins "${i}" || die fi done if use x86; then doexe lib/wrapper/linux/libwrapper.so \ lib/wrapper.jar || die elif use amd64; then doexe lib/wrapper/linux64/libwrapper.so \ lib/wrapper.jar || die fi dodir /usr/bin dosym /opt/i2p/i2prouter /usr/bin/i2prouter dosym /opt/i2p/eepget /usr/bin/eepget if use initscript; then doinitd "${FILESDIR}"/i2p || die keepdir /var/lib/i2p fperms 750 /var/lib/i2p fowners i2p:i2p /var/lib/i2p fi pax-mark m "${ED}"/opt/i2p/i2psvc } pkg_postinst() { if use initscript; then #Mv old home if it exists OLD_HOME="`egethome i2p`" NEW_HOME="/var/lib/i2p" if [[ -n "${OLD_HOME}" && "${OLD_HOME}" != "${NEW_HOME}" ]]; then esethome i2p "${NEW_HOME}" || die mv "${OLD_HOME}"/* "${NEW_HOME}"/ || ewarn "Couldn't move some files to i2p's new home dir." fi einfo "Configure the router now : http://localhost:7657/index.jsp" einfo "Use /etc/init.d/i2p start to start I2P" else einfo "Configure the router now : http://localhost:7657/index.jsp" einfo "Use 'i2prouter start' to run I2P and 'i2prouter stop' to stop it." fi }