logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

cjdns-20.2.ebuild (2344B)


  1. # Copyright 1999-2018 Gentoo Authors
  2. # Copyright 2018-2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  3. # Distributed under the terms of the GNU General Public License v2
  4. EAPI=7
  5. PYTHON_COMPAT=( python3_{4,5,6} )
  6. inherit linux-info systemd python-single-r1 flag-o-matic
  7. DESCRIPTION="encrypted IPv6 using public-key cryptography for allocation and DHT for routing"
  8. HOMEPAGE="https://github.com/cjdelisle/cjdns"
  9. SRC_URI="https://github.com/cjdelisle/cjdns/archive/cjdns-v${PV}.tar.gz"
  10. LICENSE="GPL-3"
  11. SLOT="0"
  12. KEYWORDS="~amd64 ~x86"
  13. IUSE=""
  14. S="${WORKDIR}/cjdns-cjdns-v${PV}"
  15. PATCHES=( "${FILESDIR}/${PN}-fix_systemd_units.patch" )
  16. DOCS=( "README.md" "doc" )
  17. pkg_setup() {
  18. linux-info_pkg_setup
  19. if ! linux_config_exists; then
  20. eerror "Unable to check your kernel for TUN support"
  21. else
  22. CONFIG_CHECK="~TUN"
  23. ERROR_TUN="Your kernel lacks TUN support."
  24. fi
  25. }
  26. src_compile() {
  27. python-single-r1_pkg_setup
  28. append-flags -Wno-error
  29. Seccomp_NO=1 ./do || die "./do failed"
  30. }
  31. src_install() {
  32. systemd_dounit contrib/systemd/cjdns.service
  33. systemd_dounit contrib/systemd/cjdns-resume.service
  34. newinitd contrib/openrc/cjdns cjdns
  35. einstalldocs
  36. dosbin cjdroute
  37. insinto "${ROOT}usr/share/${P}"
  38. doins -r tools
  39. doins -r contrib
  40. }
  41. pkg_postinst() {
  42. local config_file="cjdroute.conf"
  43. local config_path="${ROOT}etc/${config_file}"
  44. if [[ ! -e "${config_path}" ]] ; then
  45. ebegin "Generating ${config_file}..."
  46. (umask 077 && cjdroute --genconf > "${T}/${config_file}") || die "cjdroute --genconf failed"
  47. mv "${T}/${config_file}" "${config_path}"
  48. eend ${?} || die "Failed to generate and install ${config_file}"
  49. elog "The keys in ${config_path} have been autogenerated during"
  50. elog "emerge, they are not defaults and do not need to be overwritten."
  51. fi
  52. ewarn "Protect ${config_path}! A lost conf file means you have "
  53. ewarn "lost your password and connections and anyone who connected "
  54. ewarn "to you will no longer be able to connect. A *compromised* "
  55. ewarn "conf file means that other people can impersonate you on "
  56. ewarn "the network."
  57. ewarn
  58. einfo "The cjdns runscript will load the TUN kernel module automatically."
  59. einfo "If you are using systemd and have TUN built as a module, add tun "
  60. einfo "to /etc/modules-load.d/ for automatic loading at boot-time."
  61. einfo "echo tun > /etc/modules-load.d/cjnds.conf"
  62. }