summaryrefslogtreecommitdiff
blob: 473dc016a82a44866447b06307f9d93c123350d4 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-biology/foldingathome/foldingathome-5.0.2-r5.ebuild,v 1.7 2008/06/14 22:16:02 je_fro Exp $

# no version number on this install dir since upgrades will be using same dir
# (data will be stored here too)
I="/opt/foldingathome"

inherit eutils

DESCRIPTION="Help simulate protein folding at home"
HOMEPAGE="http://folding.stanford.edu/"
SRC_URI="http://www.stanford.edu/group/pandegroup/release/FAH502-Linux.exe"
RESTRICT="mirror strip"

SLOT="0"
IUSE=""
LICENSE="folding-at-home"
KEYWORDS="amd64 x86"

DEPEND=">=sys-apps/baselayout-1.8.0
	>=sys-libs/glibc-2.3.0
	amd64? ( app-emulation/emul-linux-x86-baselibs )"

S="${WORKDIR}"

src_unpack() {
		cp "${DISTDIR}/${A}" ${PN}
}

src_install() {
	exeinto ${I}
	newexe "${FILESDIR}"/initfolding-r2 initfolding
	newexe "${FILESDIR}"/copy_client_config-${PV}-r1 copy_client_config

	# Clients
	exeinto ${I}/client1
	doexe foldingathome
	exeinto ${I}/client2
	doexe foldingathome
	exeinto ${I}/client3
	doexe foldingathome
	exeinto ${I}/client4
	doexe foldingathome
	exeinto ${I}/client5
	doexe foldingathome
	exeinto ${I}/client6
	doexe foldingathome
	exeinto ${I}/client7
	doexe foldingathome
	exeinto ${I}/client8
	doexe foldingathome
	newinitd "${FILESDIR}"/init-${PVR} foldingathome
	newconfd "${FILESDIR}"/folding-conf.d-r1 foldingathome
}

pkg_preinst() {
	# the bash shell is important for "su -c" in init script
	enewuser foldingathome -1 /bin/bash /opt/foldingathome
}

pkg_postinst() {
	chown -R foldingathome:nogroup /opt/foldingathome
	einfo "To run Folding@home in the background at boot:"
	einfo " rc-update add foldingathome default"
	einfo ""
	einfo "Please run ${I}/initfolding to configure your client"
	einfo "and edit /etc/conf.d/foldingathome for options"
	einfo ""
}

pkg_postrm() {
	einfo "Folding@home data files were not removed."
	einfo " Remove them manually from ${I}"
	einfo ""
}