summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@gentoo.org>2018-06-18 10:22:27 -0400
committerCraig Andrews <candrews@gentoo.org>2018-06-18 12:11:55 -0400
commitec0175461ca032db61ab2403edbd1aa28d09dd56 (patch)
treeb01e297297b5ab80e15bf5e4a760657d396c64ef /net-p2p/xmr-stak
parentwww-client/chromium: remove old (diff)
downloadgentoo-ec0175461ca032db61ab2403edbd1aa28d09dd56.tar.gz
gentoo-ec0175461ca032db61ab2403edbd1aa28d09dd56.tar.bz2
gentoo-ec0175461ca032db61ab2403edbd1aa28d09dd56.zip
net-p2p/xmr-stak: Add openrc init script
Package-Manager: Portage-2.3.40, Repoman-2.3.9
Diffstat (limited to 'net-p2p/xmr-stak')
-rw-r--r--net-p2p/xmr-stak/files/xmr-stak24
-rw-r--r--net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild67
-rw-r--r--net-p2p/xmr-stak/xmr-stak-9999.ebuild5
3 files changed, 94 insertions, 2 deletions
diff --git a/net-p2p/xmr-stak/files/xmr-stak b/net-p2p/xmr-stak/files/xmr-stak
new file mode 100644
index 000000000000..21f2d35ae99d
--- /dev/null
+++ b/net-p2p/xmr-stak/files/xmr-stak
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms fo the GNU General Public License, v2
+# /etc/init.d/xmr-stak
+name="xmr-stak"
+description="Unified all-in-one Monero miner"
+pidfile=/run/xmr.pid
+command=/usr/bin/xmr-stak
+command_args="--cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config -C /etc/xmr-stak/pools.txt"
+start_stop_daemon_args="--background --make-pidfile"
+
+start_pre() {
+ if [ ! -r /etc/xmr-stak/main.config ]; then
+ eerror "/etc/xmr-stak/main.config is missing."
+ errror "Run:"
+ eerror "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config -C /etc/xmr-stak/pools.txt"
+ errror "xmr-stak can now be terminated and this service can be started"
+ return 1
+ fi
+}
+
+depend() {
+ use dns net
+}
diff --git a/net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild b/net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild
new file mode 100644
index 000000000000..8a521d6793d7
--- /dev/null
+++ b/net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils systemd
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/fireice-uk/xmr-stak.git"
+ EGIT_BRANCH="dev"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://github.com/fireice-uk/xmr-stak/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Unified all-in-one Monero miner"
+HOMEPAGE="https://github.com/fireice-uk/xmr-stak"
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="cuda devfee hwloc opencl ssl webserver"
+
+DEPEND="cuda? ( dev-util/nvidia-cuda-toolkit )
+ hwloc? ( sys-apps/hwloc )
+ opencl? ( virtual/opencl )
+ ssl? ( dev-libs/openssl:0= )
+ webserver? ( net-libs/libmicrohttpd )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ cmake-utils_src_prepare
+ if ! use devfee; then
+ sed -i -e 's!fDevDonationLevel = .*;!fDevDonationLevel = 0.0;!' xmrstak/donate-level.hpp || die
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCUDA_ENABLE=$(usex cuda)
+ -DHWLOC_ENABLE=$(usex hwloc)
+ -DMICROHTTPD_ENABLE=$(usex webserver)
+ -DOpenCL_ENABLE=$(usex opencl)
+ -DOpenSSL_ENABLE=$(usex ssl)
+ -DLIBRARY_OUTPUT_PATH=$(get_libdir)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ cmake-utils_src_install
+ systemd_newunit "${FILESDIR}"/${PN}-2.3.0.service ${PN}.service
+ doinitd "${FILESDIR}"/${PN}
+ dodir /etc/xmr-stak
+}
+
+pkg_postinst() {
+ if [ ! -e "${ROOT}etc/xmr-stak/main.config" ]; then
+ ewarn "To use xmr-stack:"
+ if use cuda || use opencl; then
+ ewarn "As root or as a user that is a member of the 'video' group,"
+ fi
+ ewarn "run:"
+ ewarn "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config -C /etc/xmr-stak/pools.txt"
+ ewarn "xmr-stak can now be terminated and 'systemctl start xmr-stak' or '/etc/init.d/xmr-stak start' can be used."
+ fi
+}
diff --git a/net-p2p/xmr-stak/xmr-stak-9999.ebuild b/net-p2p/xmr-stak/xmr-stak-9999.ebuild
index 0b8976d77f85..8a521d6793d7 100644
--- a/net-p2p/xmr-stak/xmr-stak-9999.ebuild
+++ b/net-p2p/xmr-stak/xmr-stak-9999.ebuild
@@ -50,6 +50,7 @@ src_configure() {
src_install() {
cmake-utils_src_install
systemd_newunit "${FILESDIR}"/${PN}-2.3.0.service ${PN}.service
+ doinitd "${FILESDIR}"/${PN}
dodir /etc/xmr-stak
}
@@ -60,7 +61,7 @@ pkg_postinst() {
ewarn "As root or as a user that is a member of the 'video' group,"
fi
ewarn "run:"
- ewarn "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config"
- ewarn "If the systemd will be used, xmr-stak can now be terminated and 'systemctl start xmr-stak' can be used."
+ ewarn "/usr/bin/xmr-stak --cpu /etc/xmr-stak/cpu.config --amd /etc/xmr-stak/amd.config --nvidia /etc/xmr-stak/nvidia.config -c /etc/xmr-stak/main.config -C /etc/xmr-stak/pools.txt"
+ ewarn "xmr-stak can now be terminated and 'systemctl start xmr-stak' or '/etc/init.d/xmr-stak start' can be used."
fi
}