1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit versionator user systemd
8 MY_BASEURI="https://fah.stanford.edu/file-releases/public/release/fahclient"
9 MY_64B_URI="${MY_BASEURI}/centos-5.3-64bit/v$(get_version_component_range 1-2)/fahclient_${PV}-64bit-release.tar.bz2"
10 MY_32B_URI="${MY_BASEURI}/centos-5.5-32bit/v$(get_version_component_range 1-2)/fahclient_${PV}-32bit-release.tar.bz2"
12 DESCRIPTION="Folding@Home is a distributed computing project for protein folding"
13 HOMEPAGE="http://folding.stanford.edu/FAQ-SMP.html"
14 SRC_URI="x86? ( ${MY_32B_URI} )
15 amd64? ( ${MY_64B_URI} )"
17 RESTRICT="mirror bindist strip"
19 LICENSE="FAH-EULA-2014 FAH-special-permission"
21 KEYWORDS="~amd64 ~x86"
23 # Expressly listing all deps, as this is a binpkg and it is doubtful whether
24 # i.e. uclibc or clang can provide what is necessary at runtime
25 RDEPEND="app-arch/bzip2
32 QA_PREBUILT="opt/foldingathome/*"
36 elog "Special permission is hereby granted to the Gentoo project to provide an"
37 elog "automated installer package which downloads and installs the Folding@home client"
38 elog "software. Permission is also granted for future Gentoo installer packages on the"
39 elog "condition that they continue to adhere to all of the terms of the accompanying"
40 elog "Folding@home license agreements and display this notice."
41 elog "-- Vijay S. Pande, Stanford University, 07 May 2013"
43 elog "(ref: http://foldingforum.org/viewtopic.php?f=16&t=22524&p=241992#p241992 )"
46 enewuser foldingathome -1 -1 "${EPREFIX}"/opt/foldingathome
50 local myS="fahclient_${PV}-64bit-release"
51 use x86 && myS="${myS//64bit/32bit}"
52 exeinto /opt/foldingathome
53 doexe "${myS}"/{FAHClient,FAHCoreWrapper}
55 newconfd "${FILESDIR}"/7.3/folding-conf.d foldingathome
56 cat <<EOF >"${T}"/fah-init
58 # Copyright 1999-2017 Gentoo Foundation
59 # Distributed under the terms of the GNU General Public License v2
61 start_stop_daemon_args="--chdir \"${EPREFIX}/opt/foldingathome\""
62 command="${EPREFIX}/opt/foldingathome/FAHClient"
63 command_args="\${FOLD_OPTS}"
64 command_user=foldingathome
68 newinitd "${T}"/fah-init foldingathome
70 cat <<EOF >"${T}"/fah-init.service
72 Description=Folding@Home V7 Client
73 Documentation=https://folding.stanford.edu/home/the-software/
78 WorkingDirectory=${EPREFIX}/opt/foldingathome
79 PIDFile=/run/fahclient.pid
80 ExecStart=${EPREFIX}/opt/foldingathome/FAHClient -v start
81 ExecReload=${EPREFIX}/opt/foldingathome/FAHClient -v restart
82 ExecStop=${EPREFIX}/opt/foldingathome/FAHClient -v stop
86 WantedBy=multi-user.target
88 systemd_newunit "${T}"/fah-init.service foldingathome.service
90 fowners -R foldingathome:foldingathome /opt/foldingathome
94 elog "To run Folding@home in the background at boot:"
95 elog "(openrc)\trc-update add foldingathome default"
96 elog "(systemd)\tsystemctl enable foldingathome"
98 if [ ! -e "${EPREFIX}"/opt/foldingathome/config.xml ]; then
99 elog "No config.xml file found -- please run"
100 elog "emerge --config ${P} to configure your client, or specify"
101 elog "all necessary runtime options in FOLD_OPTS within"
102 elog "${EPREFIX}/etc/conf.d/foldingathome"
105 if [[ -n ${REPLACING_VERSIONS} ]]; then
106 elog "NOTE, the 'initfolding' helper script has been dropped, please"
107 elog "use emerge --config ${P} or run FAHClient --configure directly"
108 elog "and adjust file permissions and ownership yourself"
111 elog "Please see ${EPREFIX}/opt/foldingathome/FAHClient --help for more details."
113 einfo "The original package maintainer encourages you to acquire a username and join team 36480."
114 einfo "http://folding.stanford.edu/English/Download#ntoc2"
119 elog "Folding@home data files were not removed."
120 elog "Remove them manually from ${EPREFIX}/opt/foldingathome"
124 cd "${EPREFIX}"/opt/foldingathome || die
125 su foldingathome -s /bin/sh -c "./FAHClient --configure"