From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-974042-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D26CF1396D0
	for <garchives@archives.gentoo.org>; Wed, 20 Sep 2017 18:40:14 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 269F11FC0A1;
	Wed, 20 Sep 2017 18:40:14 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E86C91FC0A1
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Sep 2017 18:40:13 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 770EA33BEBE
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Sep 2017 18:40:12 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id AFC46907F
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Sep 2017 18:40:05 +0000 (UTC)
From: "Ian Stakenvicius" <axs@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ian Stakenvicius" <axs@gentoo.org>
Message-ID: <1505932798.e4b6baa58325c29e186f6843c365bd5f168b7969.axs@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-biology/foldingathome/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sci-biology/foldingathome/foldingathome-7.4.4-r2.ebuild
X-VCS-Directories: sci-biology/foldingathome/
X-VCS-Committer: axs
X-VCS-Committer-Name: Ian Stakenvicius
X-VCS-Revision: e4b6baa58325c29e186f6843c365bd5f168b7969
X-VCS-Branch: master
Date: Wed, 20 Sep 2017 18:40:05 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 721b386d-f64a-42ab-8bbc-bbf2619987f7
X-Archives-Hash: cb041641192c35a95be1a4ca44763021

commit:     e4b6baa58325c29e186f6843c365bd5f168b7969
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 20 18:33:07 2017 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Wed Sep 20 18:39:58 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4b6baa5

sci-biology/foldingathome: misc ebuild impovements

- Added a systemd unit
- Removed usage of 'chown -R' on live filesystems
- Dropped the custom and vulnerable 'initfolding' helper script
- Improved the init script to use standard openrc-run behaviour via variables
- Dropped "unitinfo" extra command on /etc/init.d/foldingathome as it rarely works

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 .../foldingathome/foldingathome-7.4.4-r2.ebuild    | 126 +++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/sci-biology/foldingathome/foldingathome-7.4.4-r2.ebuild b/sci-biology/foldingathome/foldingathome-7.4.4-r2.ebuild
new file mode 100644
index 00000000000..bdb2a91c704
--- /dev/null
+++ b/sci-biology/foldingathome/foldingathome-7.4.4-r2.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit versionator user systemd
+
+MY_BASEURI="https://fah.stanford.edu/file-releases/public/release/fahclient"
+MY_64B_URI="${MY_BASEURI}/centos-5.3-64bit/v$(get_version_component_range 1-2)/fahclient_${PV}-64bit-release.tar.bz2"
+MY_32B_URI="${MY_BASEURI}/centos-5.5-32bit/v$(get_version_component_range 1-2)/fahclient_${PV}-32bit-release.tar.bz2"
+
+DESCRIPTION="Folding@Home is a distributed computing project for protein folding"
+HOMEPAGE="http://folding.stanford.edu/FAQ-SMP.html"
+SRC_URI="x86? ( ${MY_32B_URI} )
+	amd64? ( ${MY_64B_URI} )"
+
+RESTRICT="mirror bindist strip"
+
+LICENSE="FAH-EULA-2014 FAH-special-permission"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+# Expressly listing all deps, as this is a binpkg and it is doubtful whether
+# i.e. uclibc or clang can provide what is necessary at runtime
+RDEPEND="app-arch/bzip2
+	sys-devel/gcc
+	sys-libs/glibc
+	sys-libs/zlib"
+
+S="${WORKDIR}"
+
+QA_PREBUILT="opt/foldingathome/*"
+
+pkg_setup() {
+	elog ""
+	elog "Special permission is hereby granted to the Gentoo project to provide an"
+	elog "automated installer package which downloads and installs the Folding@home client"
+	elog "software. Permission is also granted for future Gentoo installer packages on the"
+	elog "condition that they continue to adhere to all of the terms of the accompanying"
+	elog "Folding@home license agreements and display this notice."
+	elog "-- Vijay S. Pande, Stanford University, 07 May 2013"
+	elog ""
+	elog "(ref: http://foldingforum.org/viewtopic.php?f=16&t=22524&p=241992#p241992 )"
+	elog ""
+
+	# the bash shell is important for "su -c" in init script
+	enewuser foldingathome -1 -1 "${EPREFIX}"/opt/foldingathome
+}
+
+src_install() {
+	local myS="fahclient_${PV}-64bit-release"
+	use x86 && myS="${myS//64bit/32bit}"
+	exeinto /opt/foldingathome
+	doexe "${myS}"/{FAHClient,FAHCoreWrapper}
+
+	newconfd "${FILESDIR}"/7.3/folding-conf.d foldingathome
+	cat <<EOF >"${T}"/fah-init
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+start_stop_daemon_args="--chdir \"${EPREFIX}/opt/foldingathome\""
+command="${EPREFIX}/opt/foldingathome/FAHClient"
+command_args="\${FOLD_OPTS}"
+command_user=foldingathome
+command_background=1
+pidfile="\${PIDFILE}"
+EOF
+	newinitd "${T}"/fah-init foldingathome
+
+	cat <<EOF >"${T}"/fah-init.service
+[Unit]
+Description=Folding@Home V7 Client
+Documentation=https://folding.stanford.edu/home/the-software/
+
+[Service]
+Type=simple
+User=foldingathome
+WorkingDirectory="${EPREFIX}/opt/foldingathome"
+PIDFile=/run/fahclient.pid
+ExecStart=./FAHClient -v start
+ExecReload=./FAHClient -v restart
+ExecStop=./FAHClient -v stop
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
+EOF
+	systemd_newunit "${T}"/fah-init.service foldingathome.service
+
+	chown -R foldingathome:foldingathome "${ED}"${I}
+}
+
+pkg_postinst() {
+	elog "To run Folding@home in the background at boot:"
+	elog "(openrc)\trc-update add foldingathome default"
+	elog "(systemd)\tsystemctl enable foldingathome"
+	elog ""
+	if [ ! -e "${EPREFIX}"/opt/foldingathome/config.xml ]; then
+		elog "No configuration found -- please run"
+		elog "emerge --config ${P} to configure your client, or specify"
+		elog "all necessary runtime options in FOLD_OPTS within"
+		elog "${EPREFIX}/etc/conf.d/foldingathome"
+	fi
+	if [[ -n ${REPLACING_VERSIONS} ]]; then
+		elog "NOTE, the 'initfolding' helper script has been dropped, please"
+		elog "use emerge --config ${P} or run FAHClient --configure directly"
+		elog "and adjust file permissions and ownership yourself"
+	fi
+	elog ""
+	elog "Please see ${EPREFIX}/opt/foldingathome/FAHClient --help for more details."
+	einfo ""
+	einfo "The original package maintainer encourages you to acquire a username and join team 36480."
+	einfo "http://folding.stanford.edu/English/Download#ntoc2"
+	einfo ""
+}
+
+pkg_postrm() {
+	elog "Folding@home data files were not removed."
+	elog "Remove them manually from ${EPREFIX}/opt/foldingathome"
+}
+
+pkg_config() {
+	cd "${EPREFIX}"/opt/foldingathome || die
+	su foldingathome -s /bin/bash -c "./FAHClient --configure"
+}