summaryrefslogtreecommitdiff
path: root/pcr/zeronet-git
diff options
context:
space:
mode:
authorGaming4JC <g4jc@openmailbox.org>2017-02-05 17:51:04 -0500
committerGaming4JC <g4jc@openmailbox.org>2017-02-05 17:51:04 -0500
commit1b28124676b8748519f03d8c441e95f84535f7ec (patch)
tree5f589ee7b9d5b56f5ef8fba8481a17ffb642bb19 /pcr/zeronet-git
parent8488521daf02fba14b50e4add50243e3f86b56fd (diff)
downloadabslibre-1b28124676b8748519f03d8c441e95f84535f7ec.tar.gz
abslibre-1b28124676b8748519f03d8c441e95f84535f7ec.tar.bz2
abslibre-1b28124676b8748519f03d8c441e95f84535f7ec.zip
add zeronet-git
Diffstat (limited to 'pcr/zeronet-git')
-rw-r--r--pcr/zeronet-git/PKGBUILD57
-rw-r--r--pcr/zeronet-git/zeronet.conf9
-rw-r--r--pcr/zeronet-git/zeronet.install37
-rw-r--r--pcr/zeronet-git/zeronet.service12
4 files changed, 115 insertions, 0 deletions
diff --git a/pcr/zeronet-git/PKGBUILD b/pcr/zeronet-git/PKGBUILD
new file mode 100644
index 000000000..1d3481821
--- /dev/null
+++ b/pcr/zeronet-git/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697
+# Maintainer (Arch): redfish <redfish at galactica dot pw>
+# Contributor: Lothar_m <lothar_m at riseup dot net>
+
+pkgname='zeronet-git'
+_gitname='ZeroNet'
+_gitroot='https://github.com/HelloZeroNet/ZeroNet.git'
+pkgver=0.5.0
+pkgrel=1
+arch=('any')
+url="https://zeronet.io/"
+depends=('python2>=2.7.10'
+ 'python2-gevent'
+ 'python2-msgpack'
+ )
+optdepends=('tor>=0.2.7.6: anonymity')
+makedepends=('git')
+license=('GPL2')
+pkgdesc="Decentralized websites using Bitcoin crypto and the BitTorrent network."
+provides=(zeronet)
+conflicts=(zeronet)
+source=("git+https://github.com/HelloZeroNet/ZeroNet.git"
+ "zeronet.conf"
+ "zeronet.service")
+sha512sums=('SKIP'
+ '5366a15c596854a14b344480a7c8e2d7a62311d336f72915e04d73d40419dc0690d4451ab0a2f673fb7f60e4ce2651de469bc64bc4b35ba1855dbba9a1d24a6c'
+ '8c2ff5e00e425aeb28da2b25e2ac43ebbe27aa966a983423e3ae717caecd2458473a1e993797df6f90394415afa769eadffc3dfdd76b5b486a70f3a698b7fcd5')
+install="zeronet.install"
+backup=("etc/zeronet.conf")
+options=(!strip)
+
+pkgver() {
+ cd "$srcdir/$_gitname"
+
+ # Extract version and revision from src/Config.py and append commit
+ echo -n $(grep -oP '(?<=self.version = ").+(?=")' src/Config.py).r$(grep -oP '(?<=self.rev = )\w+$' src/Config.py).g$(git rev-parse --short HEAD)
+}
+
+package() {
+ cd "$srcdir/$_gitname"
+
+ mkdir -p "$pkgdir/opt/zeronet"
+ mkdir -p "$pkgdir/var/lib/zeronet"
+ mkdir -p "$pkgdir/var/log/zeronet"
+
+ # There is no setup.py shipped, so brute-force copy
+ cp -a "$srcdir/$_gitname/." "$pkgdir/opt/zeronet/"
+
+ install -D -m644 "$srcdir/zeronet.conf" "$pkgdir/etc/zeronet.conf"
+ ## Fix TOR connection by using default ports
+ echo "tor_controller = 127.0.0.1:9051" >> $pkgdir/etc/zeronet.conf
+ echo "tor_proxy = 127.0.0.1:9050" >> $pkgdir/etc/zeronet.conf
+ install -D -m644 "$srcdir/zeronet.service" "$pkgdir/usr/lib/systemd/system/zeronet.service"
+
+ # install license
+ install -D -m644 "$srcdir/$_gitname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
diff --git a/pcr/zeronet-git/zeronet.conf b/pcr/zeronet-git/zeronet.conf
new file mode 100644
index 000000000..b09d405c7
--- /dev/null
+++ b/pcr/zeronet-git/zeronet.conf
@@ -0,0 +1,9 @@
+[global]
+data_dir = /var/lib/zeronet
+log_dir = /var/log/zeronet
+
+# ui_ip = *
+# ui_password = anypassword
+
+tor_controller = 127.0.0.1:9051
+tor_proxy = 127.0.0.1:9050
diff --git a/pcr/zeronet-git/zeronet.install b/pcr/zeronet-git/zeronet.install
new file mode 100644
index 000000000..659e8e0c6
--- /dev/null
+++ b/pcr/zeronet-git/zeronet.install
@@ -0,0 +1,37 @@
+post_install() {
+ getent passwd zeronet &>/dev/null || {
+ echo -n ">>> Creating zeronet user... "
+ useradd --system --user-group --home /var/lib/zeronet zeronet
+ echo "done"
+ } # NOTE: we do not autoremove user due to security concerns (Arch policy)
+ post_upgrade
+ # Don't run thesre operations automatically, because they are security-sensitive
+ echo ">>> Default mode is clearnet+Tor. Give zeronet permissions to configure hidden service:"
+ echo ">>> sudo usermod -a -G tor zeronet"
+ echo ">>> sudo mkdir -m 750 /var/lib/tor-auth && sudo chown tor:tor /var/lib/tor-auth"
+ echo ">>> Add/edit the following options in /etc/tor/torrc:"
+ echo ">>> ControlPort 9051"
+ echo ">>> CookieAuthentication 1"
+ echo ">>> CookieAuthFileGroupReadable 1"
+ echo ">>> CookieAuthFile /var/lib/tor-auth/control_auth_cookie"
+ echo ">>> Restart tor (reload not enough):"
+ echo ">>> sudo systemctl restart tor"
+ echo ">>> Run daemon and check status and view log:"
+ echo ">>> sudo systemctl start zeronet"
+ echo ">>> sudo systemctl status zeronet"
+ echo ">>> sudo journalctl -u zeronet"
+ echo ">>> NOTE: all operations including editing zerosite files,"
+ echo ">>> should be done as user zeronet and config must be passed"
+ echo ">>> for data directory to be selected to /var/lib/zeronet: "
+ echo ">>> sudo -u zeronet python2 zeronet.py --config_file /etc/zeronet.conf ..."
+ echo ">>> OR"
+ echo ">>> sudo su - zeronet"
+ echo ">>> cd /opt/zeronet"
+ echo ">>> python2 zeronet.py --config_file /etc/zeronet.conf ..."
+}
+
+post_upgrade() {
+ chown -R zeronet:zeronet /opt/zeronet
+ chown zeronet:zeronet /var/lib/zeronet
+ chown zeronet:zeronet /var/log/zeronet
+}
diff --git a/pcr/zeronet-git/zeronet.service b/pcr/zeronet-git/zeronet.service
new file mode 100644
index 000000000..03556054c
--- /dev/null
+++ b/pcr/zeronet-git/zeronet.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Decentralized websites using Bitcoin crypto and the BitTorrent network
+
+[Service]
+User=zeronet
+Group=zeronet
+WorkingDirectory=/opt/zeronet
+ExecStart=/usr/bin/env python2 zeronet.py --config_file /etc/zeronet.conf
+Restart=on-failure
+
+[Install]
+WantedBy=default.target