summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomZ2017-01-05 12:20:07 +0100
committerTomZ2017-01-05 12:20:07 +0100
commite0d23b50a5925a34cef7b36dd1fe2ebee9ae8273 (patch)
treed1f2a0e2c6484e4f27b0cfa186507294054c5b78
downloadaur-e0d23b50a5925a34cef7b36dd1fe2ebee9ae8273.tar.gz
Initial version
-rw-r--r--.SRCINFO32
-rw-r--r--PKGBUILD68
-rw-r--r--bitcoin.conf31
-rw-r--r--bitcoin.install113
-rw-r--r--bitcoin.logrotate11
5 files changed, 255 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..39bbfa9fa6c9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,32 @@
+# Generated by mksrcinfo v8
+# Thu Jan 5 11:19:29 UTC 2017
+pkgbase = bitcoin-classic-daemon
+ pkgdesc = Bitcoin Classic with bitcoind, bitcoin-cli, bitcoin-tx, and bitcoin-qt
+ pkgver = 1.2.0
+ pkgrel = 1
+ url = https://bitcoinclassic.com/
+ install = bitcoin.install
+ arch = i686
+ arch = x86_64
+ license = MIT
+ makedepends = boost
+ depends = boost-libs
+ depends = libevent
+ depends = openssl
+ depends = miniupnpc
+ depends = zeromq
+ provides = bitcoin-daemon
+ provides = bitcoin-cli
+ provides = bitcoin-tx
+ conflicts = bitcoin-daemon
+ conflicts = bitcoin-cli
+ conflicts = bitcoin-tx
+ source = https://github.com/bitcoinclassic/bitcoinclassic/archive/v1.2.0.tar.gz
+ source = bitcoin.logrotate
+ source = bitcoin.conf
+ sha256sums = 7f16cd27f711d7dfbdc103e79d04800a27e63ed432e3076dd34552c37710a5ac
+ sha256sums = 7bf4bdad419c1ee30b88c7e4190707c5ff250da8b23d68d5adf14043f8e2ac73
+ sha256sums = c8787560c6423605796c8d3e080cb522ed849cea12b5c23293c22e405a015a53
+
+pkgname = bitcoin-classic-daemon
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..685b6f8fa595
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,68 @@
+# Maintainer: Tom Zander
+
+pkgname=bitcoin-classic-daemon
+pkgver=1.2.0
+pkgrel=1
+pkgdesc='Bitcoin Classic with bitcoind, bitcoin-cli, bitcoin-tx, and bitcoin-qt'
+arch=('i686' 'x86_64')
+url="https://bitcoinclassic.com/"
+license=('MIT')
+depends=('boost-libs' 'libevent' 'openssl' 'miniupnpc' 'zeromq')
+makedepends=('boost')
+provides=('bitcoin-daemon' 'bitcoin-cli' 'bitcoin-tx')
+conflicts=('bitcoin-daemon' 'bitcoin-cli' 'bitcoin-tx')
+install=bitcoin.install
+source=("https://github.com/bitcoinclassic/bitcoinclassic/archive/v1.2.0.tar.gz"
+ "bitcoin.logrotate"
+ "bitcoin.conf")
+sha256sums=('7f16cd27f711d7dfbdc103e79d04800a27e63ed432e3076dd34552c37710a5ac'
+ "7bf4bdad419c1ee30b88c7e4190707c5ff250da8b23d68d5adf14043f8e2ac73"
+ "c8787560c6423605796c8d3e080cb522ed849cea12b5c23293c22e405a015a53")
+
+build() {
+ cd "$srcdir/bitcoinclassic-$pkgver"
+
+ msg2 'Building...'
+ ./autogen.sh
+ ./configure --prefix=/usr --with-incompatible-bdb --with-gui=no --enable-hardening \
+ --enable-reduce-exports --disable-gui-tests --disable-maintainer-mode
+ make -j$(nproc)
+}
+
+check() {
+ "$srcdir/bitcoinclassic-$pkgver/src/test/test_bitcoin"
+}
+
+package() {
+ cd "$srcdir/bitcoinclassic-$pkgver"
+
+ msg2 'Installing bitcoin-daemon...'
+ install -Dm755 "$srcdir/bitcoinclassic-$pkgver/src/bitcoind" "$pkgdir/usr/bin/bitcoind"
+ install -Dm644 "$srcdir/bitcoinclassic-$pkgver/contrib/debian/examples/bitcoin.conf"\
+ "$pkgdir/usr/share/doc/bitcoin/examples/bitcoin.conf"
+ install -Dm644 "$srcdir/bitcoinclassic-$pkgver/contrib/debian/manpages/bitcoind.1"\
+ "$pkgdir/usr/share/man/man1/bitcoind.1"
+ install -Dm644 "$srcdir/bitcoinclassic-$pkgver/contrib/debian/manpages/bitcoin.conf.5"\
+ "$pkgdir/usr/share/man/man5/bitcoin.conf.5"
+
+ msg2 'Installing bitcoin.conf...'
+ install -Dm 644 "$srcdir/bitcoin.conf" "$pkgdir/etc/bitcoin/bitcoin.conf.dist"
+ install -Dm 644 "$srcdir/bitcoinclassic-$pkgver/share/rpcuser/rpcuser.py" "$pkgdir/etc/bitcoin/rpcuser.py"
+
+ msg2 'Installing bitcoin.service...'
+ install -Dm 644 "$srcdir/bitcoinclassic-$pkgver/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 'Installing bitcoin-cli...'
+ install -Dm755 "$srcdir/bitcoinclassic-$pkgver/src/bitcoin-cli" "$pkgdir/usr/bin/bitcoin-cli"
+
+ msg2 'Installing bitcoin-tx...'
+ install -Dm755 "$srcdir/bitcoinclassic-$pkgver/src/bitcoin-tx" "$pkgdir/usr/bin/bitcoin-tx"
+}
diff --git a/bitcoin.conf b/bitcoin.conf
new file mode 100644
index 000000000000..8d6e980515c3
--- /dev/null
+++ b/bitcoin.conf
@@ -0,0 +1,31 @@
+# See a longer example at; /usr/share/doc/bitcoin/examples/bitcoin.conf
+
+# Defaults that are also passed in by systemd
+datadir=/var/lib/bitcoind
+pid=/var/lib/bitcoind/bitcoind.pid
+disablewallet=1
+
+# make the cookie go to /etc/bitcoin
+rpccookiefile=/etc/bitcoin/.cookie
+# make sure the cookie is readable by users able to read /etc/bitcoin
+sysperms=1
+
+# --rpcauth--
+# There additionally is the config option "rpcauth" to allow
+# multiple different users to use different credentials for login.
+#
+# The config option comes in the format:
+# rpcauth=USERNAME:SALT$HASH
+#
+# Where:
+# 1-USERNAME is desired username. Name doesn't have to be unique.
+# 2-SALT is the salt for the HMAC_SHA256 function
+# 3-HASH is a hex string that is the result of the HMAC_SHA256
+# function on the user's secret password plus the SALT as the key.
+#
+# A "canonical" password generating python script has been supplied
+# at "/etc/bitcoin/rpcuser.py". From the client-side, one connects
+# using the standard -rpcuser/-rpcpassword options.
+#
+# How to create an RPC user login credential.
+# $ python2 /etc/bitcoin/rpcuser.py <username>
diff --git a/bitcoin.install b/bitcoin.install
new file mode 100644
index 000000000000..bbe9e63a5b02
--- /dev/null
+++ b/bitcoin.install
@@ -0,0 +1,113 @@
+_bc_user=bitcoin
+_bc_group=bitcoin
+
+post_install() {
+ _mkuser
+ # disable Copy-On-Write (btrfs directories only)
+ _dir="/var/lib/bitcoind"
+ mkdir -p "$_dir"
+ _is_btrfs "$_dir" && _disable_cow "$_dir"
+ if test ! -f /etc/bitcoin/bitcoin.conf; then
+ cp /etc/bitcoin/bitcoin.conf.dist /etc/bitcoin/bitcoin.conf
+ fi
+ chown -R $_bc_user:$_bc_group /etc/bitcoin "$_dir"
+ printf "%b\n" "$bitcoin"
+}
+
+post_upgrade() {
+ _mkuser
+ chown -R $_bc_user:$_bc_group /etc/bitcoin "/var/lib/bitcoind"
+ printf "%b\n" "$bitcoin"
+}
+
+post_remove() {
+ _rmuser
+}
+
+
+# ------------------------------------------------------------------------------
+# helper functions for creating bitcoin 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 $_bc_user 2>/dev/null
+ 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" "750" "$_bc_user" "$_bc_group"
+}
+
+
+read -d '' bitcoin <<'EOF'
+############################################################
+# #
+# Bitcoin Classic #
+# ____________ #
+# #
+# To start bitcoin-classic: #
+# #
+# # systemctl start bitcoind #
+# #
+# To communicate with bitcoin-classic as a normal user: #
+# #
+# $ bitcoin-cli help #
+# #
+# Config: /etc/bitcoin/bitcoin.conf #
+# Blockchain: /var/lib/bitcoind #
+# #
+############################################################
+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
+}