X-Git-Url: http://git.squeep.com/?p=portage-squeep;a=blobdiff_plain;f=net-p2p%2Fdogecoind%2Ffiles%2Fdogecoin.initd;h=8a715e51cdb8bc33c069368e7078de72dfbe1bc0;hp=c315843cc9dd8011b2c2edc167b85331656e0015;hb=0fb88448c7b86e0c689a642046273470e1a5cee5;hpb=204ef94de5d092ab0099fd55e3059ff74212377e diff --git a/net-p2p/dogecoind/files/dogecoin.initd b/net-p2p/dogecoind/files/dogecoin.initd index c315843..8a715e5 100644 --- a/net-p2p/dogecoind/files/dogecoin.initd +++ b/net-p2p/dogecoind/files/dogecoin.initd @@ -1,14 +1,34 @@ #!/sbin/runscript # Distributed under the terms of the GNU General Public License, v2 or later -VARDIR="/var/lib/dogecoin" -CONFFILE="${VARDIR}/.dogecoin/dogecoin.conf" + +PIDFILE="${DOGECOIN_DATADIR}/dogecoind.pid" + +DOGECOIN_OPTS="-daemon -pid=${DOGECOIN_DATADIR}/dogecoind.pid -datadir=${DOGECOIN_DATADIR} ${DOGECOIN_OPTS}" depend() { need net } checkconfig() { + if [[ "${DOGECOIN_USERDIR}" == "" ]] ; then + eerror "Please edit /etc/conf.d/dogecoind" + eerror "A userdir must be specified." + return 1 + fi + + if [[ "${DOGECOIN_DATADIR}" == "" ]] ; then + eerror "Please edit /etc/conf.d/dogecoind" + eerror "A datadir must be specified." + return 1 + fi + + if [[ "${DOGECOIN_CONFFILE}" == "" ]] ; then + eerror "Please edit /etc/conf.d/dogecoind" + eerror "A conffile must be specified." + return 1 + fi + if [[ "${DOGECOIN_USER}" == "" ]] ; then eerror "Please edit /etc/conf.d/dogecoind" eerror "A user must be specified to run dogecoind as that user." @@ -27,13 +47,13 @@ checkconfig() { return 1 fi fi - if ! grep -q '^rpcpassword=' "${CONFFILE}"; then - eerror "Please edit `readlink -f ${CONFFILE}`" + if ! grep -q '^rpcpassword=' "${DOGECOIN_CONFFILE}"; then + eerror "Please edit `readlink -f ${DOGECOIN_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" + if ! stat -Lc '%a' "${DOGECOIN_CONFFILE}" | grep -q '^[4567]00$'; then + eerror "`readlink -f ${DOGECOIN_CONFFILE}` should not be readable by other users" return 1 fi return 0 @@ -65,10 +85,9 @@ stop() { start_openrc() { start-stop-daemon \ --start --user "${DOGECOIN_USER}" --name dogecoind \ - --pidfile /var/run/dogecoind.pid --make-pidfile \ - --env HOME="${VARDIR}" --exec /usr/bin/dogecoind \ + --pidfile "${PIDFILE}" \ + --env HOME="${DOGECOIN_USERDIR}" --exec /usr/bin/dogecoind \ --nicelevel "${NICELEVEL}" \ - --background \ --wait 2000 \ -- ${DOGECOIN_OPTS} eend $? @@ -76,7 +95,7 @@ start_openrc() { stop_openrc() { start-stop-daemon --stop --user "${DOGECOIN_USER}" \ - --name dogecoind --pidfile /var/run/dogecoind.pid \ + --name dogecoind --pidfile "${PIDFILE}" \ --wait 30000 \ --progress eend $? @@ -85,11 +104,10 @@ stop_openrc() { start_baselayout() { start-stop-daemon \ --start --user "${DOGECOIN_USER}" --name dogecoind \ - --pidfile /var/run/dogecoind.pid --make-pidfile \ + --pidfile "${PIDFILE}" \ --env HOME="${VARDIR}" --exec /usr/bin/dogecoind \ --chuid "${DOGECOIN_USER}" \ --nicelevel "${NICELEVEL}" \ - --background \ -- ${DOGECOIN_OPTS} eend $? } @@ -99,6 +117,6 @@ stop_baselayout() { --stop \ --user "${DOGECOIN_USER}" \ --name dogecoind \ - --pidfile /var/run/dogecoind.pid + --pidfile "${PIDFILE}" eend $? }