Gentoo Archives: gentoo-commits

From: "Jason A. Donenfeld" <zx2c4@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-vpn/wireguard-tools/
Date: Thu, 20 Aug 2020 10:13:50
Message-Id: 1597918403.f7a861be8c3e6c7f6086761f4a2f21c582b2144c.zx2c4@gentoo
1 commit: f7a861be8c3e6c7f6086761f4a2f21c582b2144c
2 Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 20 10:13:04 2020 +0000
4 Commit: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 20 10:13:23 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7a861be
7
8 net-vpn/wireguard-tools: version bump
9
10 Package-Manager: Portage-3.0.3, Repoman-3.0.0
11 Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>
12
13 net-vpn/wireguard-tools/Manifest | 1 +
14 .../wireguard-tools-1.0.20200820.ebuild | 116 +++++++++++++++++++++
15 2 files changed, 117 insertions(+)
16
17 diff --git a/net-vpn/wireguard-tools/Manifest b/net-vpn/wireguard-tools/Manifest
18 index b60ce915a97..20a8ba1966f 100644
19 --- a/net-vpn/wireguard-tools/Manifest
20 +++ b/net-vpn/wireguard-tools/Manifest
21 @@ -1 +1,2 @@
22 DIST wireguard-tools-1.0.20200513.tar.xz 94500 BLAKE2B 34a39533018416df382d180da76d6494feec1d40208c9df427c1979817dbe138c217fe4c4f4cf5cecd3c4053e6f73f1863d1e0a9ed2cad41899dda5387c15844 SHA512 4d27b262350b6b47843a323c2e7ab8d2bdd48065c265778abdec85b3f6fc92aa9af77d76e368df9cc8e435eae1c0ce50fed52e1d78db54358c1884d34be08d2c
23 +DIST wireguard-tools-1.0.20200820.tar.xz 94812 BLAKE2B 68e3db7cc337e8cf0b35d192f38d6303696c19956661a10d253241864a8b22c666b99ea62d9533bc661353c77a7df4333e336ee00235d9492347beaf58b78396 SHA512 d30ff3c4381e65cd0a751110e66f3ad1aa274b22962da748af6373210d3e4824d066a74655156d7a3d1fe6f96187a49408bc590a8023bc706c1824c0546b874c
24
25 diff --git a/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild b/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild
26 new file mode 100644
27 index 00000000000..f61364d1c25
28 --- /dev/null
29 +++ b/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild
30 @@ -0,0 +1,116 @@
31 +# Copyright 1999-2020 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +inherit linux-info bash-completion-r1 systemd toolchain-funcs
37 +
38 +DESCRIPTION="Required tools for WireGuard, such as wg(8) and wg-quick(8)"
39 +HOMEPAGE="https://www.wireguard.com/"
40 +
41 +if [[ ${PV} == 9999 ]]; then
42 + inherit git-r3
43 + EGIT_REPO_URI="https://git.zx2c4.com/wireguard-tools"
44 +else
45 + SRC_URI="https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${PV}.tar.xz"
46 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
47 +fi
48 +
49 +LICENSE="GPL-2"
50 +SLOT="0"
51 +IUSE="+wg-quick"
52 +
53 +BDEPEND="virtual/pkgconfig"
54 +DEPEND=""
55 +RDEPEND="${DEPEND}
56 + wg-quick? (
57 + || ( net-firewall/nftables net-firewall/iptables )
58 + virtual/resolvconf
59 + )
60 +"
61 +
62 +wg_quick_optional_config_nob() {
63 + CONFIG_CHECK="$CONFIG_CHECK ~$1"
64 + declare -g ERROR_$1="CONFIG_$1: This option is required for automatic routing of default routes inside of wg-quick(8), though it is not required for general WireGuard usage."
65 +}
66 +
67 +pkg_setup() {
68 + if use wg-quick; then
69 + wg_quick_optional_config_nob IP_ADVANCED_ROUTER
70 + wg_quick_optional_config_nob IP_MULTIPLE_TABLES
71 + wg_quick_optional_config_nob IPV6_MULTIPLE_TABLES
72 + if has_version net-firewall/nftables; then
73 + wg_quick_optional_config_nob NF_TABLES
74 + wg_quick_optional_config_nob NF_TABLES_IPV4
75 + wg_quick_optional_config_nob NF_TABLES_IPV6
76 + wg_quick_optional_config_nob NFT_CT
77 + wg_quick_optional_config_nob NFT_FIB
78 + wg_quick_optional_config_nob NFT_FIB_IPV4
79 + wg_quick_optional_config_nob NFT_FIB_IPV6
80 + wg_quick_optional_config_nob NF_CONNTRACK_MARK
81 + elif has_version net-firewall/iptables; then
82 + wg_quick_optional_config_nob NETFILTER_XTABLES
83 + wg_quick_optional_config_nob NETFILTER_XT_MARK
84 + wg_quick_optional_config_nob NETFILTER_XT_CONNMARK
85 + wg_quick_optional_config_nob NETFILTER_XT_MATCH_COMMENT
86 + wg_quick_optional_config_nob NETFILTER_XT_MATCH_ADDRTYPE
87 + wg_quick_optional_config_nob IP6_NF_RAW
88 + wg_quick_optional_config_nob IP_NF_RAW
89 + wg_quick_optional_config_nob IP6_NF_FILTER
90 + wg_quick_optional_config_nob IP_NF_FILTER
91 + fi
92 + fi
93 + get_version
94 + if [[ -f $KERNEL_DIR/include/uapi/linux/wireguard.h ]]; then
95 + CONFIG_CHECK="~WIREGUARD $CONFIG_CHECK"
96 + declare -g ERROR_WIREGUARD="CONFIG_WIREGUARD: This option is required for using WireGuard."
97 + elif kernel_is -ge 3 10 0 && kernel_is -lt 5 6 0 && ! has_version net-vpn/wireguard-modules; then
98 + ewarn
99 + ewarn "Your kernel does not appear to have upstream support for WireGuard"
100 + ewarn "via CONFIG_WIREGUARD. However, the net-vpn/wireguard-modules ebuild"
101 + ewarn "contains a compatibility module that should work for your kernel."
102 + ewarn "It is highly recommended to install it:"
103 + ewarn
104 + ewarn " emerge -av net-vpn/wireguard-modules"
105 + ewarn
106 + fi
107 + linux-info_pkg_setup
108 +}
109 +
110 +src_compile() {
111 + emake RUNSTATEDIR="${EPREFIX}/run" -C src CC="$(tc-getCC)" LD="$(tc-getLD)"
112 +}
113 +
114 +src_install() {
115 + dodoc README.md
116 + dodoc -r contrib
117 + emake \
118 + WITH_BASHCOMPLETION=yes \
119 + WITH_SYSTEMDUNITS=yes \
120 + WITH_WGQUICK=$(usex wg-quick) \
121 + DESTDIR="${D}" \
122 + BASHCOMPDIR="$(get_bashcompdir)" \
123 + SYSTEMDUNITDIR="$(systemd_get_systemunitdir)" \
124 + PREFIX="${EPREFIX}/usr" \
125 + -C src install
126 + use wg-quick && newinitd "${FILESDIR}/wg-quick.init" wg-quick
127 +}
128 +
129 +pkg_postinst() {
130 + einfo
131 + einfo "After installing WireGuard, if you'd like to try sending some packets through"
132 + einfo "WireGuard, you may use, for testing purposes only, the insecure client.sh"
133 + einfo "test example script:"
134 + einfo
135 + einfo " \$ bzcat ${ROOT}/usr/share/doc/${PF}/contrib/ncat-client-server/client.sh.bz2 | sudo bash -"
136 + einfo
137 + einfo "This will automatically setup interface wg0, through a very insecure transport"
138 + einfo "that is only suitable for demonstration purposes. You can then try loading the"
139 + einfo "hidden website or sending pings:"
140 + einfo
141 + einfo " \$ chromium http://192.168.4.1"
142 + einfo " \$ ping 192.168.4.1"
143 + einfo
144 + einfo "More info on getting started can be found at: https://www.wireguard.com/quickstart/"
145 + einfo
146 +}