diff options
author | Uncle Hunto | 2015-12-30 19:38:30 -0800 |
---|---|---|
committer | Uncle Hunto | 2015-12-30 19:38:30 -0800 |
commit | b13313b9e689c26ce5050f5021290e7432e3bd83 (patch) | |
tree | 2ee01b8ea6a02aaa9bc6995b778b28a8a33bd418 | |
download | aur-b13313b9e689c26ce5050f5021290e7432e3bd83.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 49 | ||||
-rw-r--r-- | PKGBUILD | 106 | ||||
-rw-r--r-- | bitcoin.conf | 137 | ||||
-rw-r--r-- | bitcoin.install | 161 | ||||
-rw-r--r-- | bitcoin.logrotate | 11 |
5 files changed, 464 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..f95e3b1cdb07 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,49 @@ +# Generated by mksrcinfo v8 +# Thu Dec 31 03:35:27 UTC 2015 +pkgbase = bitcoind-unlimited-git + pkgdesc = Bitcoin Unlimited versions of bitcoind, bitcoin-cli, and bitcoin-tx + pkgver = 20151227.bffc279 + pkgrel = 1 + url = http://www.bitcoinunlimited.info/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 + depends = boost + depends = boost-libs + depends = miniupnpc + depends = openssl + provides = bitcoin + provides = bitcoin-unlimited + provides = bitcoin-cli + provides = bitcoin-daemon + provides = bitcoin-tx + conflicts = bitcoin + conflicts = bitcoin-unlimited + 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/gandrewstone/BitcoinUnlimited.git#branch=0.11cfg_stats + source = bitcoin.conf + source = bitcoin.logrotate + sha256sums = SKIP + sha256sums = 00362da5b6c9ab3dd19b195751eb0f54bdb796d7b4bc825cb9be4ea0261c22b8 + sha256sums = 7bf4bdad419c1ee30b88c7e4190707c5ff250da8b23d68d5adf14043f8e2ac73 + sha512sums = SKIP + sha512sums = f26ca0c80e78f650a52840e52217a93fcbe1f61546f0dc7aa0cab11adb7448d28b01bca7a37ccbfd7d4f6ca37aae34470d309cd884854c1cc95b66e9f9bf3952 + sha512sums = ec2a33c546e60d14249652de0249352bbda57ee4b293715b3eaf7d37c0e9a904894dddb02ad63cad2780510fb9866fdc6421a5ed15649f63967eaae5cbb59f3b + +pkgname = bitcoind-unlimited-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..3454a4cd2f15 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,106 @@ +# Maintainer: Uncle Hunto <unclehunto äτ ÝãΗ00 Ð0τ ÇÖΜ> +# Contributor: Andy Weidenbaum <archbaum@gmail.com> + +pkgname=bitcoind-unlimited-git +pkgver=20151227.bffc279 +pkgrel=1 +pkgdesc="Bitcoin Unlimited versions of bitcoind, bitcoin-cli, and bitcoin-tx" +arch=('i686' 'x86_64') +url="http://www.bitcoinunlimited.info/software" +depends=('boost' + 'boost-libs' + 'miniupnpc' + 'openssl') +makedepends=('autoconf' + 'automake' + 'binutils' + 'expect' + 'gcc' + 'git' + 'libtool' + 'make' + 'pkg-config') +license=('MIT') +source=(git+https://github.com/gandrewstone/BitcoinUnlimited.git#branch=0.11cfg_stats + bitcoin.conf + bitcoin.logrotate) +sha256sums=('SKIP' + '00362da5b6c9ab3dd19b195751eb0f54bdb796d7b4bc825cb9be4ea0261c22b8' + '7bf4bdad419c1ee30b88c7e4190707c5ff250da8b23d68d5adf14043f8e2ac73') +sha512sums=('SKIP' + 'f26ca0c80e78f650a52840e52217a93fcbe1f61546f0dc7aa0cab11adb7448d28b01bca7a37ccbfd7d4f6ca37aae34470d309cd884854c1cc95b66e9f9bf3952' + 'ec2a33c546e60d14249652de0249352bbda57ee4b293715b3eaf7d37c0e9a904894dddb02ad63cad2780510fb9866fdc6421a5ed15649f63967eaae5cbb59f3b') +backup=('etc/bitcoin/bitcoin.conf' + 'etc/logrotate.d/bitcoin') +provides=('bitcoin' 'bitcoin-unlimited' 'bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx') +conflicts=('bitcoin' 'bitcoin-unlimited' 'bitcoin-cli' 'bitcoin-daemon' 'bitcoin-qt' + 'bitcoin-tx') +install=bitcoin.install + +pkgver() { + cd "$srcdir/BitcoinUnlimited" + git log -1 --date=short --format="%cd.%h" | sed "s|-||g" +} + +build() { + cd "$srcdir/BitcoinUnlimited" + + 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 \ + --with-gnu-ld + make +} + +package() { + cd "$srcdir/BitcoinUnlimited" + + msg2 'Installing license...' + install -Dm 644 COPYING -t "$pkgdir/usr/share/licenses/${pkgname%%-*}" + + msg2 'Installing man pages...' + install -Dm 644 contrib/debian/manpages/bitcoind.1 \ + -t "$pkgdir/usr/share/man/man1" + install -Dm 644 contrib/debian/manpages/bitcoin-cli.1 \ + -t "$pkgdir/usr/share/man/man1" + install -Dm 644 contrib/debian/manpages/bitcoin.conf.5 \ + -t "$pkgdir/usr/share/man/man5" + + 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" -t "$pkgdir/etc/bitcoin" + + msg2 'Installing bitcoin.service...' + install -Dm 644 "$srcdir/BitcoinUnlimited/contrib/init/bitcoind.service" \ + -t "$pkgdir/usr/lib/systemd/system" + + 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.conf b/bitcoin.conf new file mode 100644 index 000000000000..2e279e4669fd --- /dev/null +++ b/bitcoin.conf @@ -0,0 +1,137 @@ +## +## bitcoin.conf configuration file. Lines beginning with # are comments. +## + +# Network-related settings: + +# Run on the test network instead of the real bitcoin network. +#testnet=0 + +# Run a regression test network +#regtest=0 + +# Connect via a SOCKS5 proxy +#proxy=127.0.0.1:9050 + +# Bind to given address and always listen on it. Use [host]:port notation for IPv6 +#bind=<addr> + +# Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6 +#whitebind=<addr> + +############################################################## +## Quick Primer on addnode vs connect ## +## Let's say for instance you use addnode=4.2.2.4 ## +## addnode will connect you to and tell you about the ## +## nodes connected to 4.2.2.4. In addition it will tell ## +## the other nodes connected to it that you exist so ## +## they can connect to you. ## +## connect will not do the above when you 'connect' to it. ## +## It will *only* connect you to 4.2.2.4 and no one else.## +## ## +## So if you're behind a firewall, or have other problems ## +## finding nodes, add some using 'addnode'. ## +## ## +## If you want to stay private, use 'connect' to only ## +## connect to "trusted" nodes. ## +## ## +## If you run multiple nodes on a LAN, there's no need for ## +## all of them to open lots of connections. Instead ## +## 'connect' them all to one node that is port forwarded ## +## and has lots of connections. ## +## Thanks goes to [Noodle] on Freenode. ## +############################################################## + +# Use as many addnode= settings as you like to connect to specific peers +#addnode=69.164.218.197 +#addnode=10.0.0.2:8333 + +# Alternatively use as many connect= settings as you like to connect ONLY to specific peers +#connect=69.164.218.197 +#connect=10.0.0.1:8333 + +# Listening mode, enabled by default except when 'connect' is being used +#listen=1 + +# Maximum number of inbound+outbound connections. +#maxconnections= + +# +# JSON-RPC options (for controlling a running Bitcoin/bitcoind process) +# + +# server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commands +server=1 + +# Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. +# This option can be specified multiple times (default: bind to all interfaces) +#rpcbind=<addr> + +# You must set rpcuser and rpcpassword to secure the JSON-RPC api +rpcuser=bitcoin +rpcpassword=secret + +# How many seconds bitcoin will wait for a complete RPC HTTP request. +# after the HTTP connection is established. +rpctimeout=300 + +# By default, only RPC connections from localhost are allowed. +# Specify as many rpcallowip= settings as you like to allow connections from other hosts, +# either as a single IPv4/IPv6 or with a subnet specification. + +# NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED, +# because the rpcpassword is transmitted over the network unencrypted. + +# server=1 tells Bitcoin-Qt to accept JSON-RPC commands. +# it is also read by bitcoind to determine if RPC should be enabled +#rpcallowip=10.1.1.34/255.255.255.0 +#rpcallowip=1.2.3.4/24 +#rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96 +rpcallowip=127.0.0.1 + +# Listen for RPC connections on this TCP port: +rpcport=8332 + +# You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind +# running on another host using this option: +rpcconnect=127.0.0.1 + +# Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate +# with Bitcoin -server or bitcoind (will be removed in core 0.12) +rpcssl=1 + +# OpenSSL settings used when rpcssl=1 +rpcsslciphers=TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH +rpcsslcertificatechainfile=/etc/bitcoin/server.cert +rpcsslprivatekeyfile=/etc/bitcoin/server.pem + +# Transaction Fee Changes in 0.10.0 + +# Send transactions as zero-fee transactions if possible (default: 0) +#sendfreetransactions=0 + +# Create transactions that have enough fees (or priority) so they are likely to +# begin confirmation within n blocks (default: 2). +# This setting is over-ridden by the -paytxfee option. +txconfirmtarget=2 + +# Miscellaneous options + +# Pre-generate this many public/private key pairs, so wallet backups will be +# valid for both prior transactions and several dozen future transactions. +#keypool=100 + +# Pay an optional transaction fee every time you send bitcoins. Transactions +# with fees are more likely than free transactions to be included in generated +# blocks, so may be validated sooner. (default: 0.00) +paytxfee=0.00 + +# Spam control options + +# Fees smaller than this (in satoshi) are considered zero fee +# (relaying and mining) (default: 0.00005) +-minrelaytxfee=0.00005 + +# Rate-limit free transactions to <n>*1000 bytes per minute +# (will be obsolete in core 0.12) (default: 15) +-limitfreerelay=5 diff --git a/bitcoin.install b/bitcoin.install new file mode 100644 index 000000000000..09d71386cd54 --- /dev/null +++ b/bitcoin.install @@ -0,0 +1,161 @@ +_bc_user=bitcoin +_bc_group=bitcoin + +post_install() { + _mkuser + _mkssl + # disable Copy-On-Write (btrfs directories only) + for _dir in /srv/bitcoin; do + _is_btrfs "$_dir" && _disable_cow "$_dir" + done + chown -R $_bc_user:$_bc_group /etc/bitcoin /srv/bitcoin + printf "%b\n" "$bitcoin" +} + +post_upgrade() { + _mkuser + chown -R $_bc_user:$_bc_group /etc/bitcoin /srv/bitcoin + printf "%b\n" "$bitcoin" +} + +post_remove() { + _rmuser + rm -rf /srv/bitcoin +} + + +# ------------------------------------------------------------------------------ +# helper functions for creating bitcoin-core user / group +# ------------------------------------------------------------------------------ + +_mkuser() { + getent passwd $_bc_user &>/dev/null || { + echo -n "Creating bitcoin user... " + grep -E "^$_bc_group:" /etc/group >/dev/null || groupadd $_bc_group + useradd -m -d /etc/bitcoin -g $_bc_group -s /usr/bin/nologin $_bc_user 2>/dev/null + echo "done" + } +} + +_rmuser() { + echo -n "Removing bitcoin user... " + userdel -rf $_bc_user 2>/dev/null + echo "done" +} + + +# ------------------------------------------------------------------------------ +# helper function for enabling SSL in bitcoin-core +# ------------------------------------------------------------------------------ + +_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" +} + + +# ------------------------------------------------------------------------------ +# helper functions for disabling btrfs Copy-On-Write (CoW) +# https://wiki.archlinux.org/index.php/Btrfs#Copy-On-Write_.28CoW.29 +# ------------------------------------------------------------------------------ + +# check if dir is btrfs +_is_btrfs() { + if [[ $(findmnt --target $1 --output FSTYPE --noheadings) == 'btrfs' ]]; then + return 0 + else + return 1 + fi +} + +# disable btrfs CoW +_chattrify() { + # original dir, with trailing slash stripped if it exists + _orig_dir=$( echo "$1" | sed 's@/$@@' ) + + # if original dir exists, back it up + [[ -d "$1" ]] && mv "$1" "${_orig_dir}"_old + + # re-make original dir + mkdir -p "$1" + + # set permissions on re-made dir + chmod "$2" "$1" + + # disable btrfs CoW on re-made dir + chattr +C "$1" + + # recursive copy to restore backed up dir while maintaining disabled CoW + [[ -d "${_orig_dir}"_old ]] \ + && find "${_orig_dir}"_old -mindepth 1 -maxdepth 1 -exec cp -R '{}' "$1" \; + + # set ownership on re-made dir + chown -R $3:$4 "$1" + + # purge backed up dir + [[ -d "${_orig_dir}"_old ]] && rm -rf "${_orig_dir}"_old +} + +_disable_cow() { + _chattrify "$1" "700" "$_bc_user" "$_bc_group" +} + + +read -d '' bitcoin <<'EOF' +######################################################################## +######################################################################## +## ## +## Bitcoin Core ## +## ____________ ## +## ## +## To start bitcoin-core: ## +## ## +## # systemctl start bitcoin ## +## ## +## To communicate with bitcoin-core 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: /var/lib/bitcoind ## +## Documentation: /usr/share/doc/bitcoin ## +## ## +######################################################################## +######################################################################## +EOF diff --git a/bitcoin.logrotate b/bitcoin.logrotate new file mode 100644 index 000000000000..159f63f266ce --- /dev/null +++ b/bitcoin.logrotate @@ -0,0 +1,11 @@ +/var/lib/bitcoind/debug.log +{ + rotate 5 + copytruncate + daily + missingok + notifempty + compress + delaycompress + sharedscripts +} |