logo

overlay

My (experimental) gentoo overlay
commit: 7b5d7be07907f85c0a409e6b7b11d4cf58b6f47e
parent: 24352b92fb737e968c70778a2707afea8e1b2a14
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  8 Oct 2018 00:29:31 +0200

net-misc/cjdns: New package

Based on ::weuxel

Diffstat:

Anet-misc/cjdns/Manifest1+
Anet-misc/cjdns/cjdns-20.2.ebuild73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anet-misc/cjdns/files/cjdns-fix_systemd_units.patch39+++++++++++++++++++++++++++++++++++++++
Anet-misc/cjdns/files/cjdns.initd32++++++++++++++++++++++++++++++++
Anet-misc/cjdns/metadata.xml8++++++++
5 files changed, 153 insertions(+), 0 deletions(-)

diff --git a/net-misc/cjdns/Manifest b/net-misc/cjdns/Manifest @@ -0,0 +1 @@ +DIST cjdns-v20.2.tar.gz 4082584 BLAKE2B 62a1c76359cb09aca29f3570cba2ee8a3b6408d6f94d003eee5aeeda2ccc2959d8f4c4ecb4ef5d3273f56b634799f61aacbf5d10ecef1cddd7e48578dc453211 SHA512 31edd3ff7e62bfe2ab555da1e34d4b900829180d9558eecdd93a3d726126067c8094419683f047abdcabc444e3b2ae933a68ca4fa1b535731f977e07983b7d39 diff --git a/net-misc/cjdns/cjdns-20.2.ebuild b/net-misc/cjdns/cjdns-20.2.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +PYTHON_COMPAT=( python3_4 ) + +inherit eutils linux-info systemd python-single-r1 flag-o-matic + +DESCRIPTION="encrypted IPv6 network using public-key cryptography for address allocation and DHT for routing" +HOMEPAGE="https://github.com/cjdelisle/cjdns" +SRC_URI="https://github.com/cjdelisle/cjdns/archive/cjdns-v${PV}.tar.gz" +LICENSE="GPL-3" + +SLOT="0" +KEYWORDS="~amd64 ~x86" +ISUE="" + +DEPEND=">=net-libs/nodejs-8.11.1 + ${PYTHON_DEPS}" + +pkg_setup() { + linux-info_pkg_setup + if ! linux_config_exists; then + eerror "Unable to check your kernel for TUN support" + else + CONFIG_CHECK="~TUN" + ERROR_TUN="Your kernel lacks TUN support." + fi +} + +src_prepare() { + epatch "${FILESDIR}/${PN}-fix_systemd_units.patch" +} + +src_compile() { + python-single-r1_pkg_setup + append-flags -Wno-error + Seccomp_NO=1 ./do || die "./do failed" +} + +src_install() { + systemd_dounit contrib/systemd/cjdns.service + systemd_dounit contrib/systemd/cjdns-resume.service + newinitd "${FILESDIR}/cjdns.initd" cjdns + + dodoc README.md + dosbin cjdroute +} + +pkg_postinst() { + local config_file="cjdroute.conf" + local config_path="${ROOT}etc/${config_file}" + + if [[ ! -e "${config_path}" ]] ; then + ebegin "Generating ${config_file}..." + (umask 077 && cjdroute --genconf > "${T}/${config_file}") || die "cjdroute --genconf failed" + mv "${T}/${config_file}" "${config_path}" + eend ${?} || die "Failed to generate and install ${config_file}" + elog "The keys in ${config_path} have been autogenerated during" + elog "emerge, they are not defaults and do not need to be overwritten." + fi + ewarn "Protect ${config_path}! A lost conf file means you have " + ewarn "lost your password and connections and anyone who connected " + ewarn "to you will no longer be able to connect. A *compromised* " + ewarn "conf file means that other people can impersonate you on " + ewarn "the network." + ewarn + einfo "The cjdns runscript will load the TUN kernel module automatically." + einfo "If you are using systemd and have TUN built as a module, add tun " + einfo "to /etc/modules-load.d/ for automatic loading at boot-time." + einfo "echo tun > /etc/modules-load.d/cjnds.conf" +} diff --git a/net-misc/cjdns/files/cjdns-fix_systemd_units.patch b/net-misc/cjdns/files/cjdns-fix_systemd_units.patch @@ -0,0 +1,39 @@ +From 9303439700406cc0dc3b9817c672147848687e82 Mon Sep 17 00:00:00 2001 +From: Alex Acevedo <alex-acevedo@protonmail.com> +Date: Thu, 26 Oct 2017 16:40:29 -0400 +Subject: [PATCH] fix systemd units + +--- + contrib/systemd/cjdns-resume.service | 2 +- + contrib/systemd/cjdns.service | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/contrib/systemd/cjdns-resume.service b/contrib/systemd/cjdns-resume.service +index 3e6ce991..92c0bdc1 100644 +--- a/contrib/systemd/cjdns-resume.service ++++ b/contrib/systemd/cjdns-resume.service +@@ -4,7 +4,7 @@ After=sleep.target + + [Service] + Type=oneshot +-ExecStart=/bin/systemctl restart cjdns ++ExecStart=/usr/bin/systemctl restart cjdns + + [Install] + WantedBy=sleep.target +diff --git a/contrib/systemd/cjdns.service b/contrib/systemd/cjdns.service +index 3238aefb..aa4a49fb 100644 +--- a/contrib/systemd/cjdns.service ++++ b/contrib/systemd/cjdns.service +@@ -9,7 +9,7 @@ ProtectSystem=true + SyslogIdentifier=cjdroute + ExecStartPre=/bin/sh -ec "if ! test -s /etc/cjdroute.conf; \ + then umask 077; \ +- /usr/bin/cjdroute --genconf > /etc/cjdroute.conf; \ ++ /usr/sbin/cjdroute --genconf > /etc/cjdroute.conf; \ + echo 'WARNING: A new /etc/cjdroute.conf file has been generated.'; \ + fi" + ExecStart=/bin/sh -c "exec cjdroute --nobg < /etc/cjdroute.conf" +-- +2.13.6 + diff --git a/net-misc/cjdns/files/cjdns.initd b/net-misc/cjdns/files/cjdns.initd @@ -0,0 +1,32 @@ +#!/sbin/openrc-run +description="Encrypted networking for regular people." + +CONFFILE=/etc/cjdroute.conf + +command="/usr/sbin/cjdroute" + +depend() { + use net dns + after precursor +} + +start() { + if [ ! -e /dev/net/tun ]; then + ebegin "Inserting TUN module" + + if ! modprobe tun; then + eerror "Failed to insert TUN kernel module" + exit 1 + fi + fi + + ebegin "Starting CJDNS" + start-stop-daemon --start --quiet --exec "${command}" -- < "${CONFFILE}" + eend $? +} + +stop() { + ebegin "Stopping CJDNS" + start-stop-daemon --stop --exec "${command}" + eend $? +} diff --git a/net-misc/cjdns/metadata.xml b/net-misc/cjdns/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="person"> + <email>contact@hacktivis.me</email> + <name>Haelwenn (lanodan) Monnier</name> +</maintainer> +</pkgmetadata>