commit:     ec0175461ca032db61ab2403edbd1aa28d09dd56
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 18 14:22:27 2018 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Mon Jun 18 16:11:55 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec017546

net-p2p/xmr-stak: Add openrc init script

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 net-p2p/xmr-stak/files/xmr-stak                    | 24 ++++++++++++++++++++++
 ...r-stak-9999.ebuild => xmr-stak-2.4.5-r1.ebuild} |  5 +++--
 net-p2p/xmr-stak/xmr-stak-9999.ebuild              |  5 +++--
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/net-p2p/xmr-stak/files/xmr-stak b/net-p2p/xmr-stak/files/xmr-stak
new file mode 100644
index 00000000000..21f2d35ae99
--- /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-9999.ebuild 
b/net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild
similarity index 89%
copy from net-p2p/xmr-stak/xmr-stak-9999.ebuild
copy to net-p2p/xmr-stak/xmr-stak-2.4.5-r1.ebuild
index 0b8976d77f8..8a521d6793d 100644
--- a/net-p2p/xmr-stak/xmr-stak-9999.ebuild
+++ b/net-p2p/xmr-stak/xmr-stak-2.4.5-r1.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
 }

diff --git a/net-p2p/xmr-stak/xmr-stak-9999.ebuild 
b/net-p2p/xmr-stak/xmr-stak-9999.ebuild
index 0b8976d77f8..8a521d6793d 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
 }

Reply via email to