diff options
Diffstat (limited to 'net-p2p/primecoind/files')
-rw-r--r-- | net-p2p/primecoind/files/primecoin-sys_leveldb.patch | 176 | ||||
-rw-r--r-- | net-p2p/primecoind/files/primecoin.conf | 8 | ||||
-rw-r--r-- | net-p2p/primecoind/files/primecoin.confd | 10 | ||||
-rw-r--r-- | net-p2p/primecoind/files/primecoin.initd | 104 | ||||
-rw-r--r-- | net-p2p/primecoind/files/primecoin.service | 30 | ||||
-rw-r--r-- | net-p2p/primecoind/files/primecoind.logrotate | 7 |
6 files changed, 335 insertions, 0 deletions
diff --git a/net-p2p/primecoind/files/primecoin-sys_leveldb.patch b/net-p2p/primecoind/files/primecoin-sys_leveldb.patch new file mode 100644 index 0000000..39d0aa6 --- /dev/null +++ b/net-p2p/primecoind/files/primecoin-sys_leveldb.patch @@ -0,0 +1,176 @@ +diff -Naur primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro primecoin-0.1.2-linux/src/bitcoin-qt.pro +--- primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro 2013-08-05 08:37:14.000000000 -0400 ++++ primecoin-0.1.2-linux/src/bitcoin-qt.pro 2013-11-30 16:39:48.464770389 -0500 +@@ -4,7 +4,7 @@ + VERSION = 0.8.3 + INCLUDEPATH += src src/json src/qt + QT += network +-DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE ++DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE LEVELDB_WITHOUT_MEMENV + CONFIG += no_include_pwd + CONFIG += thread + +@@ -98,25 +98,29 @@ + QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets + } + ++contains(USE_SYSTEM_LEVELDB, 1) { ++ LIBS += -lleveldb ++} else { + INCLUDEPATH += src/leveldb/include src/leveldb/helpers +-LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a ++LIBS += $$PWD/src/leveldb/libleveldb.a + !win32 { + # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences +- genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a ++ genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a + } else { + # make an educated guess about what the ranlib command is called + isEmpty(QMAKE_RANLIB) { + QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib) + } + LIBS += -lshlwapi +- genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a ++ genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a + } + genleveldb.target = $$PWD/src/leveldb/libleveldb.a + genleveldb.depends = FORCE + PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a + QMAKE_EXTRA_TARGETS += genleveldb ++} + # Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it. +-QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean ++QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb && $(MAKE) clean || true + + # regenerate src/build.h + !win32|contains(USE_BUILD_INFO, 1) { +diff -Naur primecoin-0.1.2-linux.orig/src/src/leveldb.cpp primecoin-0.1.2-linux/src/src/leveldb.cpp +--- primecoin-0.1.2-linux.orig/src/src/leveldb.cpp 2013-08-05 08:37:20.000000000 -0400 ++++ primecoin-0.1.2-linux/src/src/leveldb.cpp 2013-11-30 16:41:25.632773774 -0500 +@@ -8,7 +8,9 @@ + #include <leveldb/env.h> + #include <leveldb/cache.h> + #include <leveldb/filter_policy.h> +-#include <memenv/memenv.h> ++#ifndef LEVELDB_WITHOUT_MEMENV ++#include <memenv.h> ++#endif + + #include <boost/filesystem.hpp> + +@@ -43,8 +45,12 @@ + options = GetOptions(nCacheSize); + options.create_if_missing = true; + if (fMemory) { ++#ifndef LEVELDB_WITHOUT_MEMENV + penv = leveldb::NewMemEnv(leveldb::Env::Default()); + options.env = penv; ++#else ++ throw std::runtime_error("CLevelDB(): compiled without memenv support"); ++#endif + } else { + if (fWipe) { + printf("Wiping LevelDB in %s\n", path.string().c_str()); +diff -Naur primecoin-0.1.2-linux.orig/src/src/makefile.unix primecoin-0.1.2-linux/src/src/makefile.unix +--- primecoin-0.1.2-linux.orig/src/src/makefile.unix 2013-08-05 08:37:21.000000000 -0400 ++++ primecoin-0.1.2-linux/src/src/makefile.unix 2013-11-30 17:20:06.545854617 -0500 +@@ -111,8 +111,7 @@ + # adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work. + xLDFLAGS=$(LDHARDENING) $(LDFLAGS) + +-OBJS= \ +- leveldb/libleveldb.a \ ++BASEOBJS := \ + obj/alert.o \ + obj/version.o \ + obj/checkpoints.o \ +@@ -121,7 +120,6 @@ + obj/crypter.o \ + obj/key.o \ + obj/db.o \ +- obj/init.o \ + obj/keystore.o \ + obj/main.o \ + obj/net.o \ +@@ -141,25 +139,44 @@ + obj/hash.o \ + obj/bloom.o \ + obj/noui.o \ +- obj/leveldb.o \ + obj/txdb.o \ + obj/prime.o \ + obj/checkpointsync.o + ++OBJS := \ ++ obj/leveldb.o \ ++ obj/init.o \ ++ $(BASEOBJS) ++ ++TESTOBJS := \ ++ obj-test/leveldb.o \ ++ $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) \ ++ $(BASEOBJS) ++ + all: primecoind + + test check: test_primecoin FORCE + ./test_primecoin + ++ifdef USE_SYSTEM_LEVELDB ++ LIBS += -lleveldb ++ TESTLIBS += -lmemenv ++else + # + # LevelDB support + # + MAKEOVERRIDES = +-LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a ++LIBS += $(CURDIR)/leveldb/libleveldb.a ++TESTLIBS += $(CURDIR)/leveldb/libmemenv.a + DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) + DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) + leveldb/libleveldb.a: +- @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd .. ++ @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a && cd .. ++leveldb/libmemenv.a: ++ @echo "Building LevelDB memenv ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libmemenv.a && cd .. ++OBJS += leveldb/libleveldb.a ++TESTOBJS += leveldb/libmemenv.a ++endif + + # auto-generated dependencies: + -include obj/*.P +@@ -170,24 +187,22 @@ + version.cpp: obj/build.h + DEFS += -DHAVE_BUILD_INFO + +-obj/%.o: %.cpp +- $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< ++P_TO_D = \ + @cp $(@:%.o=%.d) $(@:%.o=%.P); \ +- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ ++ sed -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ + rm -f $(@:%.o=%.d) + +-primecoind: $(OBJS:obj/%=obj/%) +- $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS) ++obj/%.o: %.cpp ++ $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $< ++ $(P_TO_D) + +-TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) ++primecoind: $(OBJS) ++ $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS) + + obj-test/%.o: test/%.cpp +- $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< +- @cp $(@:%.o=%.d) $(@:%.o=%.P); \ +- sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ +- -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ +- rm -f $(@:%.o=%.d) ++ $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $< ++ $(P_TO_D) + + test_primecoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) + $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS) diff --git a/net-p2p/primecoind/files/primecoin.conf b/net-p2p/primecoind/files/primecoin.conf new file mode 100644 index 0000000..c6a55f3 --- /dev/null +++ b/net-p2p/primecoind/files/primecoin.conf @@ -0,0 +1,8 @@ +# http://www.bitcoin.org/smf/index.php?topic=644.0 +#rpcuser= +#rpcpassword= + + + + + diff --git a/net-p2p/primecoind/files/primecoin.confd b/net-p2p/primecoind/files/primecoin.confd new file mode 100644 index 0000000..6dd0def --- /dev/null +++ b/net-p2p/primecoind/files/primecoin.confd @@ -0,0 +1,10 @@ +# Config file for /etc/init.d/primecoind + +# owner of primeciond process (don't change, must be existing) +PRIMECOIN_USER="primecoin" + +# See http://www.bitcoin.org/smf/index.php?topic=1063 +PRIMECOIN_OPTS="${PRIMECOIN_OPTS}" + +# nice level +NICELEVEL="19" diff --git a/net-p2p/primecoind/files/primecoin.initd b/net-p2p/primecoind/files/primecoin.initd new file mode 100644 index 0000000..a821c37 --- /dev/null +++ b/net-p2p/primecoind/files/primecoin.initd @@ -0,0 +1,104 @@ +#!/sbin/runscript +# Distributed under the terms of the GNU General Public License, v2 or later + +VARDIR="/var/lib/primecoin" +CONFFILE="${VARDIR}/.primecoin/primecoin.conf" + +depend() { + need net +} + +checkconfig() { + if [[ "${PRIMECOIN_USER}" == "" ]] ; then + eerror "Please edit /etc/conf.d/primecoind" + eerror "A user must be specified to run primecoind 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 "${PRIMECOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then + eerror "Please edit /etc/conf.d/primecoind" + eerror "Specified user must exist!" + return 1 + fi + if `echo "${PRIMECOIN_USER}" | grep ':' -sq` ; then + if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${PRIMECOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then + eerror "Please edit /etc/conf.d/primecoind" + 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 Primecoind daemon" + + pkg-config openrc + if [ $? = 0 ]; then + start_openrc + else + start_baselayout + fi +} + +stop() { + ebegin "Stopping Primecoin daemon" + + pkg-config openrc + if [ $? = 0 ]; then + stop_openrc + else + stop_baselayout + fi +} + +start_openrc() { + start-stop-daemon \ + --start --user "${PRIMECOIN_USER}" --name primecoind \ + --pidfile /var/run/primecoind.pid --make-pidfile \ + --env HOME="${VARDIR}" --exec /usr/bin/primecoind \ + --nicelevel "${NICELEVEL}" \ + --background \ + --wait 2000 \ + -- ${PRIMECOIN_OPTS} + eend $? +} + +stop_openrc() { + start-stop-daemon --stop --user "${PRIMECOIN_USER}" \ + --name primecoind --pidfile /var/run/primecoind.pid \ + --wait 30000 \ + --progress + eend $? +} + +start_baselayout() { + start-stop-daemon \ + --start --user "${PRIMECOIN_USER}" --name primecoind \ + --pidfile /var/run/primecoind.pid --make-pidfile \ + --env HOME="${VARDIR}" --exec /usr/bin/primecoind \ + --chuid "${PRIMECOIN_USER}" \ + --nicelevel "${NICELEVEL}" \ + --background \ + -- ${PRIMECOIN_OPTS} + eend $? +} + +stop_baselayout() { + start-stop-daemon \ + --stop \ + --user "${PRIMECOIN_USER}" \ + --name primecoind \ + --pidfile /var/run/primecoind.pid + eend $? +} diff --git a/net-p2p/primecoind/files/primecoin.service b/net-p2p/primecoind/files/primecoin.service new file mode 100644 index 0000000..8fd2eca --- /dev/null +++ b/net-p2p/primecoind/files/primecoin.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/primecoind.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/primecoind.service.d/myopts.conf" +# containing: +# [Service] +# Environment="PRIMECOIN_OPTS=-debug -logtimestamps" +# Nice=10 +# This will override the setting appearing below. + +# Note that almost all daemon options could be specified in +# /etc/primecoin/primecoin.conf + +[Unit] +Description=Primecoin Daemon +After=network.target + +[Service] +User=primecoin +Environment=PRIMECOIN_OPTS= +ExecStart=/usr/bin/primecoind -daemon=0 $PRIMECOIN_OPTS +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/net-p2p/primecoind/files/primecoind.logrotate b/net-p2p/primecoind/files/primecoind.logrotate new file mode 100644 index 0000000..84623c4 --- /dev/null +++ b/net-p2p/primecoind/files/primecoind.logrotate @@ -0,0 +1,7 @@ +/var/lib/primecoin/.primecoin/debug.log { + weekly + sharedscripts + postrotate + killall -HUP primecoind + endscript +} |