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