summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-02-25 18:22:17 +0000
committerAnthony G. Basile <blueness@gentoo.org>2014-02-25 18:22:17 +0000
commite5bc36d20576cb13f9a4ce55728ef83db9dd8452 (patch)
tree71ebe0765827a18b98bdef12128b6a33a3393b01 /net-p2p
parentAdd imrpoved initd, bug #500602 (diff)
downloadgentoo-2-e5bc36d20576cb13f9a4ce55728ef83db9dd8452.tar.gz
gentoo-2-e5bc36d20576cb13f9a4ce55728ef83db9dd8452.tar.bz2
gentoo-2-e5bc36d20576cb13f9a4ce55728ef83db9dd8452.zip
Add imrpoved initd, bug #500602
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)
Diffstat (limited to 'net-p2p')
-rw-r--r--net-p2p/datacoin-hp/ChangeLog5
-rw-r--r--net-p2p/datacoin-hp/files/datacoin.initd111
2 files changed, 22 insertions, 94 deletions
diff --git a/net-p2p/datacoin-hp/ChangeLog b/net-p2p/datacoin-hp/ChangeLog
index 0561cd45a882..fdd5afdf7000 100644
--- a/net-p2p/datacoin-hp/ChangeLog
+++ b/net-p2p/datacoin-hp/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for net-p2p/datacoin-hp
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-p2p/datacoin-hp/ChangeLog,v 1.2 2014/01/08 06:29:46 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/datacoin-hp/ChangeLog,v 1.3 2014/02/25 18:22:17 blueness Exp $
+
+ 25 Feb 2014; Anthony G. Basile <blueness@gentoo.org> files/datacoin.initd:
+ Add imrpoved initd, bug #500602
08 Jan 2014; Mike Frysinger <vapier@gentoo.org> datacoin-hp-9999.ebuild:
Inherit the user eclass for enewuser/etc...
diff --git a/net-p2p/datacoin-hp/files/datacoin.initd b/net-p2p/datacoin-hp/files/datacoin.initd
index 415f410d31fc..158062a7e7a3 100644
--- a/net-p2p/datacoin-hp/files/datacoin.initd
+++ b/net-p2p/datacoin-hp/files/datacoin.initd
@@ -1,104 +1,29 @@
#!/sbin/runscript
-# Distributed under the terms of the GNU General Public License, v2 or later
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/datacoin-hp/files/datacoin.initd,v 1.2 2014/02/25 18:22:16 blueness Exp $
-VARDIR="/var/lib/datacoin"
-CONFFILE="${VARDIR}/.datacoin/datacoin.conf"
+vardir="/var/lib/datacoin"
+conffile="${vardir}/.datacoin/datacoin.conf"
+datacoind_user="${DATACOIN_USER:-nobody:nobody}"
+
+description="Bitcoin crypto-currency wallet for automated services"
+pidfile="/run/${SVCNAME}.pid"
+command="/usr/bin/datacoind"
+command_args="${DATACOIN_OPTS}"
+command_background="true"
+start_stop_daemon_args="-u ${datacoind_user} -e HOME=${vardir} -N ${NICELEVEL:-0} -w 2000"
depend() {
need net
}
-checkconfig() {
- if [[ "${DATACOIN_USER}" == "" ]] ; then
- eerror "Please edit /etc/conf.d/datacoind"
- eerror "A user must be specified to run datacoind as that user."
- eerror "Modify USER to your needs (you may also add a group after a colon)"
- return 1
- fi
- if ! `getent passwd | cut -d ':' -f 1 | grep $( echo "${DATACOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then
- eerror "Please edit /etc/conf.d/datacoind"
- eerror "Specified user must exist!"
- return 1
- fi
- if `echo "${DATACOIN_USER}" | grep ':' -sq` ; then
- if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${DATACOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then
- eerror "Please edit /etc/conf.d/datacoind"
- eerror "Specified group must exist!"
- return 1
- fi
- fi
- if ! grep -q '^rpcpassword=' "${CONFFILE}"; then
- eerror "Please edit `readlink -f ${CONFFILE}`"
+start_pre() {
+ checkpath -f -o ${datacoind_user} -m 0400 ${conffile} || return 1
+
+ if ! grep -q '^rpcpassword=' "${conffile}"; then
+ eerror "Please edit `readlink -f ${conffile}`"
eerror "There must be at least a line assigning rpcpassword=something-secure"
return 1
fi
- if ! stat -Lc '%a' "${CONFFILE}" | grep -q '^[4567]00$'; then
- eerror "`readlink -f ${CONFFILE}` should not be readable by other users"
- return 1
- fi
- return 0
-}
-
-start() {
- checkconfig || return 1
- ebegin "Starting Datacoind daemon"
-
- pkg-config openrc
- if [ $? = 0 ]; then
- start_openrc
- else
- start_baselayout
- fi
-}
-
-stop() {
- ebegin "Stopping Datacoin daemon"
-
- pkg-config openrc
- if [ $? = 0 ]; then
- stop_openrc
- else
- stop_baselayout
- fi
-}
-
-start_openrc() {
- start-stop-daemon \
- --start --user "${DATACOIN_USER}" --name datacoind \
- --pidfile /var/run/datacoind.pid --make-pidfile \
- --env HOME="${VARDIR}" --exec /usr/bin/datacoind \
- --nicelevel "${NICELEVEL}" \
- --background \
- --wait 2000 \
- -- ${DATACOIN_OPTS}
- eend $?
-}
-
-stop_openrc() {
- start-stop-daemon --stop --user "${DATACOIN_USER}" \
- --name datacoind --pidfile /var/run/datacoind.pid \
- --wait 30000 \
- --progress
- eend $?
-}
-
-start_baselayout() {
- start-stop-daemon \
- --start --user "${DATACOIN_USER}" --name datacoind \
- --pidfile /var/run/datacoind.pid --make-pidfile \
- --env HOME="${VARDIR}" --exec /usr/bin/datacoind \
- --chuid "${DATACOIN_USER}" \
- --nicelevel "${NICELEVEL}" \
- --background \
- -- ${DATACOIN_OPTS}
- eend $?
-}
-
-stop_baselayout() {
- start-stop-daemon \
- --stop \
- --user "${DATACOIN_USER}" \
- --name datacoind \
- --pidfile /var/run/datacoind.pid
- eend $?
}