aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Delaney <della5@iinet.com.au>2014-06-17 10:42:55 +0800
committerIan Delaney <della5@iinet.com.au>2014-06-17 10:42:55 +0800
commit8291ea80c141d7cca70d4de3cc67e045bda71e36 (patch)
treea0004117dbcdd90372a39c96f0cff70bd2939fca /net-p2p/mincoin/files
parentlong overdue update (diff)
downloadimprovise-8291ea80c141d7cca70d4de3cc67e045bda71e36.tar.gz
improvise-8291ea80c141d7cca70d4de3cc67e045bda71e36.tar.bz2
improvise-8291ea80c141d7cca70d4de3cc67e045bda71e36.zip
mass purge of old ebuilds mostly in portage
Diffstat (limited to 'net-p2p/mincoin/files')
-rw-r--r--net-p2p/mincoin/files/mincoin.conf3
-rw-r--r--net-p2p/mincoin/files/mincoin.confd10
-rw-r--r--net-p2p/mincoin/files/mincoin.initd104
-rw-r--r--net-p2p/mincoin/files/mincoin.logrotate8
-rw-r--r--net-p2p/mincoin/files/mincoin.service30
5 files changed, 155 insertions, 0 deletions
diff --git a/net-p2p/mincoin/files/mincoin.conf b/net-p2p/mincoin/files/mincoin.conf
new file mode 100644
index 0000000..199c1bc
--- /dev/null
+++ b/net-p2p/mincoin/files/mincoin.conf
@@ -0,0 +1,3 @@
+# http://www.bitcoin.org/smf/index.php?topic=644.0
+#rpcuser=
+#rpcpassword=
diff --git a/net-p2p/mincoin/files/mincoin.confd b/net-p2p/mincoin/files/mincoin.confd
new file mode 100644
index 0000000..be881c1
--- /dev/null
+++ b/net-p2p/mincoin/files/mincoin.confd
@@ -0,0 +1,10 @@
+# Config file for /etc/init.d/mincoin
+
+# owner of mincion process (don't change, must be existing)
+MINCOIN_USER="mincoin"
+
+# See http://www.bitcoin.org/smf/index.php?topic=1063
+MINCOIN_OPTS="${MINCOIN_OPTS}"
+
+# nice level
+NICELEVEL="19"
diff --git a/net-p2p/mincoin/files/mincoin.initd b/net-p2p/mincoin/files/mincoin.initd
new file mode 100644
index 0000000..27c6e80
--- /dev/null
+++ b/net-p2p/mincoin/files/mincoin.initd
@@ -0,0 +1,104 @@
+#!/sbin/runscript
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+VARDIR="/var/lib/mincoin"
+CONFFILE="${VARDIR}/.mincoin/mincoin.conf"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [[ "${MINCOIN_USER}" == "" ]] ; then
+ eerror "Please edit /etc/conf.d/mincoin"
+ eerror "A user must be specified to run mincoin 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 "${MINCOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then
+ eerror "Please edit /etc/conf.d/mincoin"
+ eerror "Specified user must exist!"
+ return 1
+ fi
+ if `echo "${MINCOIN_USER}" | grep ':' -sq` ; then
+ if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${MINCOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then
+ eerror "Please edit /etc/conf.d/mincoin"
+ eerror "Specified group must exist!"
+ return 1
+ fi
+ fi
+ 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 MinCoin daemon"
+
+ pkg-config openrc
+ if [ $? = 0 ]; then
+ start_openrc
+ else
+ start_baselayout
+ fi
+}
+
+stop() {
+ ebegin "Stopping MinCoin daemon"
+
+ pkg-config openrc
+ if [ $? = 0 ]; then
+ stop_openrc
+ else
+ stop_baselayout
+ fi
+}
+
+start_openrc() {
+ start-stop-daemon \
+ --start --user "${MINCOIN_USER}" --name mincoin \
+ --pidfile /var/run/mincoin.pid --make-pidfile \
+ --env HOME="${VARDIR}" --exec /usr/bin/mincoin \
+ --nicelevel "${NICELEVEL}" \
+ --background \
+ --wait 2000 \
+ -- ${MINCOIN_OPTS}
+ eend $?
+}
+
+stop_openrc() {
+ start-stop-daemon --stop --user "${MINCOIN_USER}" \
+ --name mincoin --pidfile /var/run/mincoin.pid \
+ --wait 30000 \
+ --progress
+ eend $?
+}
+
+start_baselayout() {
+ start-stop-daemon \
+ --start --user "${MINCOIN_USER}" --name mincoin \
+ --pidfile /var/run/mincoin.pid --make-pidfile \
+ --env HOME="${VARDIR}" --exec /usr/bin/mincoin \
+ --chuid "${MINCOIN_USER}" \
+ --nicelevel "${NICELEVEL}" \
+ --background \
+ -- ${MINCOIN_OPTS}
+ eend $?
+}
+
+stop_baselayout() {
+ start-stop-daemon \
+ --stop \
+ --user "${MINCOIN_USER}" \
+ --name mincoin \
+ --pidfile /var/run/mincoin.pid
+ eend $?
+}
diff --git a/net-p2p/mincoin/files/mincoin.logrotate b/net-p2p/mincoin/files/mincoin.logrotate
new file mode 100644
index 0000000..5022cad
--- /dev/null
+++ b/net-p2p/mincoin/files/mincoin.logrotate
@@ -0,0 +1,8 @@
+/var/lib/mincoin/.mincoin/debug.log {
+ weekly
+ sharedscripts
+ postrotate
+ killall -HUP mincoin
+ endscript
+}
+
diff --git a/net-p2p/mincoin/files/mincoin.service b/net-p2p/mincoin/files/mincoin.service
new file mode 100644
index 0000000..c4b154e
--- /dev/null
+++ b/net-p2p/mincoin/files/mincoin.service
@@ -0,0 +1,30 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create file
+# "/etc/systemd/system/mincoin.service.d/*.conf"
+# containing your changes
+
+# For example, if you want to change some daemon and/or unit options,
+# create a file named
+# "/etc/systemd/system/mincoin.service.d/myopts.conf"
+# containing:
+# [Service]
+# Environment="MINCOIN_OPTS=-debug -logtimestamps"
+# Nice=10
+# This will override the setting appearing below.
+
+# Note that almost all daemon options could be specified in
+# /etc/mincoin/mincoin.conf
+
+[Unit]
+Description=MinCoin Daemon
+After=network.target
+
+[Service]
+User=mincoin
+Environment=MINCOIN_OPTS=
+ExecStart=/usr/bin/mincoin -daemon=0 $MINCOIN_OPTS
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target