aboutsummaryrefslogtreecommitdiff
blob: 163e165a6697d7341e8da22e518d7a0f546ad882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

#
# Don't forget to keep things in files dir in sync with normal boinc package!
#

EAPI="2"

inherit eutils

MY_PN="${PN//-bin/}"
MY_PV="${PV//./_}"
DESCRIPTION="The Berkeley Open Infrastructure for Network Computing"
HOMEPAGE="http://boinc.ssl.berkeley.edu/"
SRC_URI="
	amd64? ( http://${MY_PN}dl.ssl.berkeley.edu/dl/${MY_PN}_${PV}_x86_64-pc-linux-gnu.sh )
	x86? ( http://${MY_PN}dl.ssl.berkeley.edu/dl/${MY_PN}_${PV}_i686-pc-linux-gnu.sh )
	"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="X"

RDEPEND="
	!sci-misc/boinc
	>=dev-libs/openssl-0.9.7
	>=net-misc/curl-7.15.5
	sys-apps/util-linux
	sys-libs/zlib
	X? ( x11-libs/wxGTK:2.8 )
	"
DEPEND="${RDEPEND}
	app-misc/ca-certificates
	X? (
		media-libs/freeglut
		media-libs/jpeg
		media-libs/mesa
		x11-libs/libX11
		x11-libs/libXmu
		x11-libs/libXt
		x11-proto/xproto
	)
	"

S="${WORKDIR}"/BOINC

LANGS="ar be bg ca cs da de el en_US es eu fi fr hr hu it ja lt lv nb nl pl pt
pt_BR ro ru sk sl sv_SE tr uk zh_CN zh_TW"
for LNG in ${LANGS}; do
	IUSE="${IUSE} linguas_${LNG}"
done

src_unpack() {
	local target
	use x86 && target="i686" || target="x86_64"
	cp "${DISTDIR}"/${MY_PN}_${PV}_${target}-pc-linux-gnu.sh "${WORKDIR}"
	cd "${WORKDIR}"
	sh ${MY_PN}_${PV}_${target}-pc-linux-gnu.sh
	# patch up certificates
	mkdir "${S}"/curl/
	ln -s /etc/ssl/certs/ca-certificates.crt "${S}"/curl/ca-bundle.crt
}

src_install() {
	dodir /var/lib/${MY_PN}
	newinitd "${FILESDIR}"/${MY_PN}.init ${MY_PN}
	newconfd "${FILESDIR}"/${MY_PN}.conf ${MY_PN}
	# fix ${PN}.conf file for binary package
	sed -i \
		-e "s:/usr/bin/${MY_PN}_client:/opt/${MY_PN}/${MY_PN}:g" \
		"${D}"/etc/conf.d/${MY_PN} || die "sed failed"
	if use X; then
		# icon
		newicon "${S}"/${MY_PN}mgr.48x48.png ${MY_PN}.png
		# desktop
		make_desktop_entry /opt/${MY_PN}/run_manager "${MY_PN}" ${MY_PN} "Education;Science" /var/lib/${MY_PN}
	fi
	# use correct path in scripts
	sed -i \
		-e "s:${S}:/var/lib/${MY_PN}:g" \
		-e "s:./${MY_PN}:/opt/${MY_PN}/${MY_PN}:g" \
		run_client || die "sed run_client failed"
	sed -i \
		-e "s:${S}:/var/lib/${MY_PN}:g" \
		-e "s:./${MY_PN}mgr:/opt/${MY_PN}/${MY_PN}mgr:g" \
		run_manager || die "sed run_manager failed"
	# install binaries
	exeopts -m0755
	exeinto /opt/${MY_PN}

	doexe "${S}"/{${MY_PN},${MY_PN}cmd,${MY_PN}mgr,run_client,run_manager}
	fowners 0:${MY_PN} /opt/${MY_PN}/{${MY_PN},${MY_PN}cmd,${MY_PN}mgr,run_client,run_manager}
	# locale
	mkdir -p "${D}"/opt/${MY_PN}/locale
	insopts -m0644
	insinto /opt/${MY_PN}/locale
	cd "${S}"/locale/
	for LNG in ${LINGUAS}; do
		doins -r "${LNG}"
	done
	dosym /opt/${MY_PN}/locale /var/lib/${MY_PN}/locale
	cd "${S}"
	dosym /etc/ssl/certs/ca-certificates.crt /var/lib/${MY_PN}/ca-bundle.crt
}

pkg_preinst() {
	enewgroup ${MY_PN}
	enewuser ${MY_PN} -1 -1 /var/lib/${MY_PN} ${MY_PN}
}

pkg_postinst() {
	echo
	elog "You are using the binary distributed version."
	elog "The manager can be found at /opt/${MY_PN}/run_manager"
	echo
	elog "You need to attach to a project to do anything useful with ${MY_PN}."
	elog "You can do this by running /etc/init.d/${MY_PN} attach"
	elog "${MY_PN} The howto for configuration is located at:"
	elog "http://${MY_PN}.berkeley.edu/anonymous_platform.php"
	echo
	# Add warning about the new password for the client, bug 121896.
	elog "If you need to use the graphical client the password is in"
	elog "/var/lib/${MY_PN}/gui_rpc_auth.cfg"
	elog "You should change this to something more memorable (can be blank)."
	echo
}