cjdns-20.2.ebuild (2344B)
- # Copyright 1999-2018 Gentoo Authors
- # Copyright 2018-2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
- # Distributed under the terms of the GNU General Public License v2
- EAPI=7
- PYTHON_COMPAT=( python3_{4,5,6} )
- inherit linux-info systemd python-single-r1 flag-o-matic
- DESCRIPTION="encrypted IPv6 using public-key cryptography for 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"
- IUSE=""
- S="${WORKDIR}/cjdns-cjdns-v${PV}"
- PATCHES=( "${FILESDIR}/${PN}-fix_systemd_units.patch" )
- DOCS=( "README.md" "doc" )
- 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_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 contrib/openrc/cjdns cjdns
- einstalldocs
- dosbin cjdroute
- insinto "${ROOT}usr/share/${P}"
- doins -r tools
- doins -r contrib
- }
- 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"
- }