summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2013-08-20 17:19:32 -0300
committerNicolás Reynolds <fauno@endefensadelsl.org>2013-08-20 17:19:32 -0300
commit5928610927ccf6b39d56abebb9f288f09c3fbdbd (patch)
treefa1d509c55dd4de8c549254a337733a2572b1bed /pcr
parent66d4ae97deec0f75699d70ead6f85a6568093701 (diff)
CJDNS
Diffstat (limited to 'pcr')
-rw-r--r--pcr/cjdns-git/PKGBUILD77
-rw-r--r--pcr/cjdns-git/cjdns-git.install21
2 files changed, 98 insertions, 0 deletions
diff --git a/pcr/cjdns-git/PKGBUILD b/pcr/cjdns-git/PKGBUILD
new file mode 100644
index 000000000..2e9646006
--- /dev/null
+++ b/pcr/cjdns-git/PKGBUILD
@@ -0,0 +1,77 @@
+# Maintainer: Prurigro
+# Contributor: Prurigro
+# Contributor: Werecat
+# Contributor: Xyne
+
+_pkgname=cjdns
+pkgname=${_pkgname}-git
+pkgver=0.3.1473
+pkgrel=1
+pkgdesc="A routing engine designed for security, scalability, speed and ease of use."
+url="https://github.com/cjdelisle/${_pkgname}"
+license=('GPL3')
+makedepends=('git' 'cmake' 'python2')
+optdepends=('python2: required by the python cjdnsadmin utilities')
+arch=('i686' 'x86_64' 'armv6h' 'armv7h')
+install=${pkgname}.install
+backup=("etc/default/${_pkgname}")
+
+source=("git://github.com/cjdelisle/${_pkgname}.git#branch=master")
+sha256sums=('SKIP')
+
+pkgver() {
+ cd "${srcdir}/${_pkgname}"
+ git describe --always | sed 's|-|.|g;s|[^\.]*\.||;s|\.[^\.]*$||'
+}
+
+prepare() {
+ cd "${srcdir}/${_pkgname}"
+
+ ## Clean previous builds and resync
+ ./clean
+
+ mkdir build
+
+ ## Set occurances of python to python2 due to a naming conflict between Debian and Archlinux
+ find "${srcdir}/${_pkgname}"/contrib/python \
+ -type f \
+ -exec sed -i 's@/usr/bin/python\s*$@/usr/bin/python2@;s@/usr/bin/env\ python@/usr/bin/env\ python2@' {} \+
+}
+
+build() {
+ cd "${srcdir}"/${_pkgname}
+
+ ## Disable Arch's generic makepkg optimizations (set via /etc/makepkg.conf) in favour of those specified by cjdns
+ unset MAKEFLAGS
+# unset CFLAGS
+# unset CPPFLAGS
+
+ ## Build using the ./do script
+ export NO_DEBUG=1
+ cd build
+ cmake ..
+ make
+}
+
+## Package creation helper functions
+_package_cjdns() {
+ install -D -m755 "${srcdir}"/${_pkgname}/build/admin/angel/cjdroute2 "${pkgdir}"/usr/bin/cjdroute
+ install -D -m755 "${srcdir}"/${_pkgname}/build/admin/angel/${_pkgname} "${pkgdir}"/usr/bin/${_pkgname}
+ install -D -m644 "${srcdir}"/${_pkgname}/contrib/systemd/${_pkgname}.service "${pkgdir}"/usr/lib/systemd/system/${_pkgname}.service
+ install -D -m755 "${srcdir}"/${_pkgname}/contrib/bash/i_am_stupid.sh "${pkgdir}"/usr/bin/cjdns-recoverconfig
+}
+_package_pyutils() {
+ install -D -m644 "${srcdir}"/${_pkgname}/contrib/python/cjdnsadmin/cjdnsadmin.py "${pkgdir}"/usr/lib/$(python2-config --libs | grep -o -E python2.*)/cjdnsadmin/cjdnsadmin.py
+ install -D -m644 "${srcdir}"/${_pkgname}/contrib/python/cjdnsadmin/bencode.py "${pkgdir}"/usr/lib/$(python2-config --libs | grep -o -E python2.*)/cjdnsadmin/bencode.py
+ install -D -m644 "${srcdir}"/${_pkgname}/contrib/python/cjdnsadmin/__init__.py "${pkgdir}"/usr/lib/$(python2-config --libs | grep -o -E python2.*)/cjdnsadmin/__init__.py
+ install -D -m755 "${srcdir}"/${_pkgname}/contrib/python/cjdnslog "${pkgdir}"/usr/bin/cjdns-log
+ install -D -m755 "${srcdir}"/${_pkgname}/contrib/python/dumptable "${pkgdir}"/usr/bin/cjdns-dumptable
+ install -D -m755 "${srcdir}"/${_pkgname}/contrib/python/findnodes "${pkgdir}"/usr/bin/cjdns-findnodes
+ install -D -m755 "${srcdir}"/${_pkgname}/contrib/python/pingAll.py "${pkgdir}"/usr/bin/cjdns-pingAll
+}
+
+## Package creation function: comment out a helper function to remove its associated functionality
+package() {
+ _package_cjdns ## Core binaries (cjdns and cjdroute), a systemd service file and a config recovery script written in bash
+ _package_pyutils ## Miscellaneous python2-based cjdns admin port utility scripts and libraries
+}
diff --git a/pcr/cjdns-git/cjdns-git.install b/pcr/cjdns-git/cjdns-git.install
new file mode 100644
index 000000000..5e9e1a64c
--- /dev/null
+++ b/pcr/cjdns-git/cjdns-git.install
@@ -0,0 +1,21 @@
+post_install() {
+ if [ $(ps -A | ps -A | grep -cE "systemd$") = 1 ]; then
+ systemctl --system daemon-reload
+ fi
+
+ if [ -z $(type -P python2) ]; then
+ echo "You don't currently have python2 installed. It isn't required to use cjdns, but some scripts have been included in the package that won't function without"
+ fi
+
+ echo "By default, the cjdns configuration file is expected to be located @ /etc/cjdroute.conf"
+}
+
+post_upgrade() {
+ if [ $(ps -A | ps -A | grep -cE "systemd$") = 1 ]; then
+ systemctl --system daemon-reload
+ fi
+
+ if [ $(grep -c cjdns /etc/passwd) = 1 ]; then
+ echo "The user 'cjdns' has been detected on your system but is no longer required by this package; if it was installed by a previous version of this package, it can now be safely deleted."
+ fi
+}