diff options
-rw-r--r-- | .SRCINFO | 45 | ||||
-rw-r--r-- | PKGBUILD | 109 | ||||
-rw-r--r-- | bitcoin-reindex.service | 18 | ||||
-rw-r--r-- | bitcoin.conf | 13 | ||||
-rw-r--r-- | bitcoin.install | 96 | ||||
-rw-r--r-- | bitcoin.logrotate | 11 | ||||
-rw-r--r-- | bitcoin.service | 17 |
7 files changed, 309 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..21f94395bfdf --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,45 @@ +pkgbase = bitcoinxt-only-bigblocks-git + pkgdesc = BitcoinXT headless P2P node + pkgver = 20150815 + pkgrel = 1 + url = https://bitcoinxt.software + install = bitcoin.install + arch = i686 + arch = x86_64 + license = MIT + makedepends = autoconf + makedepends = automake + makedepends = binutils + makedepends = expect + makedepends = gcc + makedepends = git + makedepends = libtool + makedepends = make + makedepends = pkg-config + makedepends = yasm + depends = boost + depends = boost-libs + depends = miniupnpc + depends = openssl + provides = bitcoin-cli + provides = bitcoin-daemon + provides = bitcoin-tx + conflicts = bitcoin-cli + conflicts = bitcoin-daemon + conflicts = bitcoin-qt + conflicts = bitcoin-tx + backup = etc/bitcoin/bitcoin.conf + backup = etc/logrotate.d/bitcoin + source = git+https://github.com/bitcoinxt/bitcoinxt + source = bitcoin.conf + source = bitcoin.logrotate + source = bitcoin.service + source = bitcoin-reindex.service + sha256sums = SKIP + sha256sums = 67c464e4314ab5f7234a091098a05706989394086e4ee21e1d9155b9d1421796 + sha256sums = 8f05207b586916d489b7d25a68eaacf6e678d7cbb5bfbac551903506b32f904f + sha256sums = 5e45f2ceaeb7bfa60aeb66ca4167068191eb4358af03f95ac70fd96d9b006349 + sha256sums = 10ad0b8c356559886634eaf658992004045853ec26cddee143d16125cb75e8f1 + +pkgname = bitcoinxt-only-bigblocks-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..42a4875ce8bd --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,109 @@ +# Maintainer: Andy Weidenbaum <archbaum@gmail.com> + +pkgname=bitcoinxt-only-bigblocks-git +pkgver=20150806.83e0b45 +pkgrel=1 +pkgdesc="BitcoinXT headless P2P node" +arch=('i686' 'x86_64') +url="https://bitcoinxt.software" +depends=('boost' + 'boost-libs' + 'miniupnpc' + 'openssl') +makedepends=('autoconf' + 'automake' + 'binutils' + 'expect' + 'gcc' + 'git' + 'libtool' + 'make' + 'pkg-config' + 'yasm') +license=('MIT') +source=('git+https://github.com/bitcoinxt/bitcoinxt#branch=only-bigblocks' + 'bitcoin.conf' + 'bitcoin.logrotate' + 'bitcoin.service' + 'bitcoin-reindex.service') +sha256sums=('SKIP' + '67c464e4314ab5f7234a091098a05706989394086e4ee21e1d9155b9d1421796' + '8f05207b586916d489b7d25a68eaacf6e678d7cbb5bfbac551903506b32f904f' + '5e45f2ceaeb7bfa60aeb66ca4167068191eb4358af03f95ac70fd96d9b006349' + '10ad0b8c356559886634eaf658992004045853ec26cddee143d16125cb75e8f1') +backup=('etc/bitcoin/bitcoin.conf' + 'etc/logrotate.d/bitcoin') +provides=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx') +conflicts=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-qt' 'bitcoin-tx') +install=bitcoin.install + +pkgver() { + cd ${pkgname%%-*} + printf "%s.%s" "$(git log -1 --format="%cd" --date=short | sed "s|-||g")" "$(git rev-parse --short HEAD)" +} + +build() { + cd "${pkgname%%-*}" + + msg2 'Building...' + ./autogen.sh + ./configure \ + --prefix=/usr \ + --sbindir=/usr/bin \ + --libexecdir=/usr/lib/bitcoin \ + --sysconfdir=/etc \ + --sharedstatedir=/usr/share/bitcoin \ + --localstatedir=/var/lib/bitcoin \ + --enable-hardening \ + --with-gui=no \ + --disable-wallet \ + --with-gnu-ld + make +} + +package() { + cd "${pkgname%%-*}" + + msg2 'Installing license...' + install -Dm 644 COPYING "$pkgdir/usr/share/licenses/${pkgname%%-*}/COPYING" + + msg2 'Installing man pages...' + install -Dm 644 contrib/debian/manpages/bitcoind.1 \ + "$pkgdir/usr/share/man/man1/bitcoind.1" + install -Dm 644 contrib/debian/manpages/bitcoin-cli.1 \ + "$pkgdir/usr/share/man/man1/bitcoin-cli.1" + install -Dm 644 contrib/debian/manpages/bitcoin.conf.5 \ + "$pkgdir/usr/share/man/man5/bitcoin.conf.5" + + msg2 'Installing documentation...' + install -dm 755 "$pkgdir/usr/share/doc/bitcoin" + for _doc in \ + `find doc -maxdepth 1 -type f -name "*.md" -printf '%f\n'` \ + release-notes; do + cp -dpr --no-preserve=ownership doc/$_doc \ + "$pkgdir/usr/share/doc/bitcoin/$_doc" + done + + msg2 'Installing bitcoin...' + make DESTDIR="$pkgdir" install + + msg2 'Installing bitcoin.conf...' + install -Dm 600 "$srcdir/bitcoin.conf" "$pkgdir/etc/bitcoin/bitcoin.conf" + + msg2 'Installing bitcoin.service...' + install -Dm 644 "$srcdir/bitcoin.service" \ + "$pkgdir/usr/lib/systemd/system/bitcoin.service" + install -Dm 644 "$srcdir/bitcoin-reindex.service" \ + "$pkgdir/usr/lib/systemd/system/bitcoin-reindex.service" + + msg2 'Installing bitcoin.logrotate...' + install -Dm 644 "$srcdir/bitcoin.logrotate" "$pkgdir/etc/logrotate.d/bitcoin" + + msg2 'Installing bash completion...' + install -Dm 644 contrib/bitcoind.bash-completion \ + "$pkgdir/usr/share/bash-completion/completions/bitcoind" + + msg2 'Cleaning up pkgdir...' + find "$pkgdir" -type d -name .git -exec rm -r '{}' + + find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' + +} diff --git a/bitcoin-reindex.service b/bitcoin-reindex.service new file mode 100644 index 000000000000..ca40c191e7c8 --- /dev/null +++ b/bitcoin-reindex.service @@ -0,0 +1,18 @@ +[Unit] +Description=Bitcoin Daemon (reindex) +Conflicts=bitcoin.service +After=network.target + +[Service] +User=bitcoin +Group=bitcoin +ExecStart=/usr/bin/bitcoind -daemon=0 \ + -conf=/etc/bitcoin/bitcoin.conf \ + -datadir=/srv/bitcoin \ + -reindex \ + -pid=/run/bitcoind.pid +ExecReload=/usr/bin/kill -HUP $MAINPID +ExecStop=/usr/bin/bitcoind stop + +[Install] +WantedBy=multi-user.target diff --git a/bitcoin.conf b/bitcoin.conf new file mode 100644 index 000000000000..b88ecf527886 --- /dev/null +++ b/bitcoin.conf @@ -0,0 +1,13 @@ +rpcconnect=127.0.0.1 +rpcport=8332 +rpcuser=bitcoin +rpcpassword=secret +rpcssl=1 +rpcallowip=127.0.0.1 +rpcsslcertificatechainfile=/etc/bitcoin/server.cert +rpcsslprivatekeyfile=/etc/bitcoin/server.pem +rpcsslciphers=TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH +rpcthreads=1000 +rpctimeout=300 +txindex=1 +server=1 diff --git a/bitcoin.install b/bitcoin.install new file mode 100644 index 000000000000..c064b3b61e5e --- /dev/null +++ b/bitcoin.install @@ -0,0 +1,96 @@ +post_install() { + _mkuser + _mkssl + chown -R bitcoin:bitcoin /etc/bitcoin /srv/bitcoin + printf "%b\n" "$bitcoin" +} + +post_upgrade() { + _mkuser + chown -R bitcoin:bitcoin /etc/bitcoin /srv/bitcoin + printf "%b\n" "$bitcoin" +} + +post_remove() { + _rmuser + rm -rf /srv/bitcoin +} + +_mkuser() { + getent passwd bitcoin &>/dev/null || { + echo -n "Creating bitcoin user... " + grep -E "^bitcoin:" /etc/group >/dev/null || groupadd bitcoin + useradd -m -d /etc/bitcoin -g bitcoin -s /usr/bin/nologin bitcoin 2>/dev/null + echo "done" + } +} + +_rmuser() { + echo -n "Removing bitcoin user... " + userdel -rf bitcoin 2>/dev/null + echo "done" +} + +_mkssl() { + echo -n "Enabling SSL..." # https://en.bitcoin.it/wiki/Enabling_SSL_on_original_client_daemon + mkdir -p /{etc,srv}/bitcoin + openssl genrsa -out /etc/bitcoin/server.pem 2048 + expect <<EOF | perl -ne 'print if /-----BEGIN\sCERTIFICATE-----/../-----END\sCERTIFICATE-----/' > /etc/bitcoin/server.cert + spawn openssl req -new -x509 -nodes -sha1 -days 3650 -key /etc/bitcoin/server.pem + expect "Country*" { + send "\r" + } + expect "State*" { + send "\r" + } + expect "Locality*" { + send "\r" + } + expect "Organization*" { + send "\r" + } + expect "Organizational*" { + send "\r" + } + expect "Common*" { + send "\r" + } + expect "Email*" { + send "\r" + } + expect eof +EOF + echo "done" +} + +read -d '' bitcoin <<'EOF' +######################################################################## +######################################################################## +## ## +## BitcoinXT ## +## _________ ## +## ## +## To start bitcoinxt: ## +## ## +## # systemctl start bitcoin ## +## ## +## To communicate with bitcoinxt as a normal user: ## +## ## +## $ mkdir -p ~/.bitcoin ## +## $ cat > ~/.bitcoin/bitcoin.conf <<'EOF' ## +## rpcconnect=127.0.0.1 ## +## rpcport=8332 ## +## rpcuser=bitcoin ## +## rpcpassword=secret ## +## rpcssl=1 ## +## EOF ## +## ## +## $ bitcoin-cli getmininginfo ## +## ## +## Config: /etc/bitcoin/bitcoin.conf ## +## Blockchain: /srv/bitcoin ## +## Documentation: /usr/share/doc/bitcoin ## +## ## +######################################################################## +######################################################################## +EOF diff --git a/bitcoin.logrotate b/bitcoin.logrotate new file mode 100644 index 000000000000..fe13fb2e7049 --- /dev/null +++ b/bitcoin.logrotate @@ -0,0 +1,11 @@ +/srv/bitcoin/debug.log +{ + rotate 5 + copytruncate + daily + missingok + notifempty + compress + delaycompress + sharedscripts +} diff --git a/bitcoin.service b/bitcoin.service new file mode 100644 index 000000000000..fda8f3270508 --- /dev/null +++ b/bitcoin.service @@ -0,0 +1,17 @@ +[Unit] +Description=Bitcoin Daemon +Conflicts=bitcoin-reindex.service +After=network.target + +[Service] +User=bitcoin +Group=bitcoin +ExecStart=/usr/bin/bitcoind -daemon=0 \ + -conf=/etc/bitcoin/bitcoin.conf \ + -datadir=/srv/bitcoin \ + -pid=/run/bitcoind.pid +ExecReload=/usr/bin/kill -HUP $MAINPID +ExecStop=/usr/bin/bitcoind stop + +[Install] +WantedBy=multi-user.target |