1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit versionator user systemd
8 DESCRIPTION="Folding@Home is a distributed computing project for protein folding"
9 HOMEPAGE="https://foldingathome.org/"
10 SRC_URI="https://download.foldingathome.org/releases/public/release/fahclient/centos-6.7-64bit/v$(get_version_component_range 1-2)/fahclient_${PV}-64bit-release.tar.bz2"
12 RESTRICT="mirror bindist strip"
14 LICENSE="FAH-EULA-2014 FAH-special-permission"
18 # Expressly listing all deps, as this is a binpkg and it is doubtful whether
19 # i.e. uclibc or clang can provide what is necessary at runtime
20 DEPEND="dev-util/patchelf"
21 RDEPEND="app-arch/bzip2
22 =dev-libs/openssl-1.0*:*
27 S="${WORKDIR}/fahclient_${PV}-64bit-release"
29 QA_PREBUILT="opt/foldingathome/*"
33 elog "Special permission is hereby granted to the Gentoo project to provide an"
34 elog "automated installer package which downloads and installs the Folding@home client"
35 elog "software. Permission is also granted for future Gentoo installer packages on the"
36 elog "condition that they continue to adhere to all of the terms of the accompanying"
37 elog "Folding@home license agreements and display this notice."
38 elog "-- Vijay S. Pande, Stanford University, 07 May 2013"
40 elog "(ref: http://foldingforum.org/viewtopic.php?f=16&t=22524&p=241992#p241992 )"
43 enewuser foldingathome -1 -1 "${EPREFIX}"/opt/foldingathome
47 patchelf --set-rpath "${EPREFIX}/opt/foldingathome" FAHClient || die
48 patchelf --set-rpath "${EPREFIX}/opt/foldingathome" FAHCoreWrapper || die
50 dosym "../../usr/$(get_libdir)/libssl.so.1.0.0" /opt/foldingathome/libssl.so.10
51 dosym "../../usr/$(get_libdir)/libcrypto.so.1.0.0" /opt/foldingathome/libcrypto.so.10
53 exeinto /opt/foldingathome
54 doexe {FAHClient,FAHCoreWrapper}
56 insinto /opt/foldingathome
57 doins sample-config.xml
59 newconfd "${FILESDIR}"/7.3/folding-conf.d foldingathome
60 cat <<EOF >"${T}"/fah-init
62 # Copyright 1999-2017 Gentoo Foundation
63 # Distributed under the terms of the GNU General Public License v2
65 start_stop_daemon_args="--chdir \"${EPREFIX}/opt/foldingathome\""
66 command="${EPREFIX}/opt/foldingathome/FAHClient"
67 command_args="\${FOLD_OPTS}"
68 command_user=foldingathome
72 newinitd "${T}"/fah-init foldingathome
74 cat <<EOF >"${T}"/fah-init.service
76 Description=Folding@Home V7 Client
77 Documentation=https://foldingathome.org
82 WorkingDirectory=${EPREFIX}/opt/foldingathome
83 PIDFile=/run/fahclient.pid
84 ExecStart=${EPREFIX}/opt/foldingathome/FAHClient -v start
85 ExecReload=${EPREFIX}/opt/foldingathome/FAHClient -v restart
86 ExecStop=${EPREFIX}/opt/foldingathome/FAHClient -v stop
90 WantedBy=multi-user.target
92 systemd_newunit "${T}"/fah-init.service foldingathome.service
94 fowners -R foldingathome:foldingathome /opt/foldingathome
98 elog "To run Folding@home in the background at boot:"
99 elog "(openrc)\trc-update add foldingathome default"
100 elog "(systemd)\tsystemctl enable foldingathome"
102 if [ ! -e "${EPREFIX}"/opt/foldingathome/config.xml ]; then
103 elog "No config.xml file found -- please run"
104 elog "emerge --config ${P} to configure your client, or specify"
105 elog "all necessary runtime options in FOLD_OPTS within"
106 elog "${EPREFIX}/etc/conf.d/foldingathome"
109 if [[ -n ${REPLACING_VERSIONS} ]]; then
110 elog "NOTE, the 'initfolding' helper script has been dropped, please"
111 elog "use emerge --config ${P} or run FAHClient --configure directly"
112 elog "and adjust file permissions and ownership yourself"
115 elog "Please see ${EPREFIX}/opt/foldingathome/FAHClient --help for more details."
117 einfo "The original package maintainer encourages you to acquire a username and join team 36480."
118 einfo "http://folding.stanford.edu/English/Download#ntoc2"
123 elog "Folding@home data files were not removed."
124 elog "Remove them manually from ${EPREFIX}/opt/foldingathome"
128 cd "${EPREFIX}"/opt/foldingathome || die
129 su foldingathome -s /bin/sh -c "./FAHClient --configure"