| 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/dnetc/dnetc-2.9107.516.ebuild,v 1.1 2011/10/23 06:12:17 robbat2 Exp $
|
| 4 |
|
| 5 |
EAPI=2
|
| 6 |
inherit user
|
| 7 |
|
| 8 |
MAJ_PV=${PV:0:6}
|
| 9 |
MIN_PV=${PV:7:9}
|
| 10 |
|
| 11 |
DESCRIPTION="distributed.net client"
|
| 12 |
HOMEPAGE="http://www.distributed.net"
|
| 13 |
#SRC_URI_x86="x86? ( http://http.distributed.net/pub/dcti/v${MAJ_PV}/dnetc${MIN_PV}-linux-x86-elf-uclibc.tar.gz )"
|
| 14 |
#SRC_URI_amd64="amd64? ( http://http.distributed.net/pub/dcti/v${MAJ_PV}/dnetc${MIN_PV}-linux-amd64.tar.gz )"
|
| 15 |
#SRC_URI_ppc="ppc? ( http://http.distributed.net/pub/dcti/v${MAJ_PV}/dnetc${MIN_PV}-linux-ppc-uclibc.tar.gz )"
|
| 16 |
SRC_URI_sparc="sparc? ( http://http.distributed.net/pub/dcti/v${MAJ_PV}/dnetc${MIN_PV}-linux-sparc-v7.tar.gz )"
|
| 17 |
SRC_URI="${SRC_URI_amd64} ${SRC_URI_ppc} ${SRC_URI_x86} ${SRC_URI_sparc}"
|
| 18 |
|
| 19 |
LICENSE="distributed.net"
|
| 20 |
SLOT="0"
|
| 21 |
KEYWORDS="~sparc" # x86,amd64,ppc not available for this version
|
| 22 |
IUSE=""
|
| 23 |
RESTRICT="mirror"
|
| 24 |
|
| 25 |
DEPEND=""
|
| 26 |
RDEPEND="net-dns/bind-tools"
|
| 27 |
|
| 28 |
QA_PRESTRIPPED="opt/distributed.net/dnetc"
|
| 29 |
|
| 30 |
S=${WORKDIR}/dnetc
|
| 31 |
|
| 32 |
src_prepare() {
|
| 33 |
binname=""
|
| 34 |
if use amd64; then
|
| 35 |
binname=dnetc${MIN_PV}-linux-amd64
|
| 36 |
elif use x86; then
|
| 37 |
binname=dnetc${MIN_PV}-linux-x86-elf-uclibc
|
| 38 |
elif use ppc; then
|
| 39 |
binname=dnetc${MIN_PV}-linux-ppc-elf-uclibc
|
| 40 |
fi
|
| 41 |
[[ -z "${binname}" ]] && die "Name of dnetc binary for this platform undefined"
|
| 42 |
mv "${binname}" dnetc || die "$binname binary is missing"
|
| 43 |
}
|
| 44 |
|
| 45 |
src_install() {
|
| 46 |
exeinto /opt/distributed.net
|
| 47 |
doexe dnetc
|
| 48 |
|
| 49 |
doman dnetc.1
|
| 50 |
dodoc docs/CHANGES.txt docs/dnetc.txt docs/readme.*
|
| 51 |
|
| 52 |
newinitd "${FILESDIR}"/dnetc.initd dnetc
|
| 53 |
newconfd "${FILESDIR}"/dnetc.confd dnetc
|
| 54 |
|
| 55 |
keepdir /var/spool/dnetc
|
| 56 |
}
|
| 57 |
|
| 58 |
pkg_preinst() {
|
| 59 |
if [ -e /opt/distributed.net/dnetc ] && [ -e /etc/init.d/dnetc ]; then
|
| 60 |
einfo "flushing old buffers"
|
| 61 |
source /etc/conf.d/dnetc
|
| 62 |
|
| 63 |
if [ -e /opt/distributed.net/dnetc.ini ]; then
|
| 64 |
# use ini file
|
| 65 |
/opt/distributed.net/dnetc -quiet -ini /opt/distributed.net/dnetc.ini -flush
|
| 66 |
elif [ ! -e /opt/distributed.net/dnetc.ini ] && [ ! -z ${EMAIL} ]; then
|
| 67 |
# email adress from config
|
| 68 |
/opt/distributed.net/dnetc -quiet -flush -e ${EMAIL}
|
| 69 |
fi
|
| 70 |
|
| 71 |
einfo "removing old buffer files"
|
| 72 |
rm -f /opt/distributed.net/buff*
|
| 73 |
fi
|
| 74 |
|
| 75 |
enewgroup dnetc
|
| 76 |
enewuser dnetc -1 -1 /opt/distributed.net dnetc
|
| 77 |
}
|
| 78 |
|
| 79 |
pkg_postinst() {
|
| 80 |
chown -Rf dnetc:dnetc /opt/distributed.net
|
| 81 |
chmod 0555 /opt/distributed.net/dnetc
|
| 82 |
|
| 83 |
elog "To run distributed.net client in the background at boot:"
|
| 84 |
elog " rc-update add dnetc default"
|
| 85 |
elog ""
|
| 86 |
elog "Either configure your email address in /etc/conf.d/dnetc"
|
| 87 |
elog "or create the configuration file /opt/distributed.net/dnetc.ini"
|
| 88 |
}
|
| 89 |
|
| 90 |
pkg_postrm() {
|
| 91 |
if [ -d /opt/distributed.net ]; then
|
| 92 |
elog "All files has not been removed from /opt/distributed.net"
|
| 93 |
fi
|
| 94 |
}
|