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