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-modules/
Date: Thu, 26 Dec 2019 16:47:35
Message-Id: 1577378835.4fb358cb8610e006e7db367b4f1b2d70c5c3a760.zx2c4@gentoo
1 commit: 4fb358cb8610e006e7db367b4f1b2d70c5c3a760
2 Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 26 16:36:16 2019 +0000
4 Commit: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 26 16:47:15 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fb358cb
7
8 net-vpn/wireguard-modules: import split compat modules at 0.0.20191226
9
10 Package-Manager: Portage-2.3.83, Repoman-2.3.20
11 Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>
12
13 net-vpn/wireguard-modules/Manifest | 1 +
14 net-vpn/wireguard-modules/metadata.xml | 13 +++
15 .../wireguard-modules-0.0.20191226.ebuild | 93 ++++++++++++++++++++++
16 .../wireguard-modules-9999.ebuild | 93 ++++++++++++++++++++++
17 4 files changed, 200 insertions(+)
18
19 diff --git a/net-vpn/wireguard-modules/Manifest b/net-vpn/wireguard-modules/Manifest
20 new file mode 100644
21 index 00000000000..1eebb610b44
22 --- /dev/null
23 +++ b/net-vpn/wireguard-modules/Manifest
24 @@ -0,0 +1 @@
25 +DIST wireguard-linux-compat-0.0.20191226.tar.xz 261488 BLAKE2B ca2e6eda18508287fa1d3deaa07d28ec6a13732895a5fcc580a2405d6d197618f0e3e798a484ee94c3feb1f178aaacd11f3c8e3a59c00e4fc957d0f645cc9f81 SHA512 7eba183128555ca5fd8b171179fe8ec7b9a67c618ad000bc9c5475ff74097e0e2c220a1f1dd82393fbde6dbbba5c1114bfd725e733a5f4acfbb23248538f6afb
26
27 diff --git a/net-vpn/wireguard-modules/metadata.xml b/net-vpn/wireguard-modules/metadata.xml
28 new file mode 100644
29 index 00000000000..3b5b3d014e7
30 --- /dev/null
31 +++ b/net-vpn/wireguard-modules/metadata.xml
32 @@ -0,0 +1,13 @@
33 +<?xml version="1.0" encoding="UTF-8"?>
34 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
35 +<pkgmetadata>
36 + <maintainer type="person">
37 + <email>zx2c4@g.o</email>
38 + <name>Jason A. Donenfeld</name>
39 + </maintainer>
40 + <use>
41 + <flag name="module">Compile the actual WireGuard kernel module. Most certainly you want this enabled, unless you're doing something strange.</flag>
42 + <flag name="module-src">Install the module source code to /usr/src, in case you like building kernel modules yourself.</flag>
43 + <flag name="debug">Enable verbose debug reporting in dmesg of various WireGuard peer and device information.</flag>
44 + </use>
45 +</pkgmetadata>
46
47 diff --git a/net-vpn/wireguard-modules/wireguard-modules-0.0.20191226.ebuild b/net-vpn/wireguard-modules/wireguard-modules-0.0.20191226.ebuild
48 new file mode 100644
49 index 00000000000..2fe86edba28
50 --- /dev/null
51 +++ b/net-vpn/wireguard-modules/wireguard-modules-0.0.20191226.ebuild
52 @@ -0,0 +1,93 @@
53 +# Copyright 1999-2019 Gentoo Authors
54 +# Distributed under the terms of the GNU General Public License v2
55 +
56 +EAPI=6
57 +
58 +MODULES_OPTIONAL_USE="module"
59 +inherit linux-mod bash-completion-r1
60 +
61 +DESCRIPTION="Simple yet fast and modern VPN that utilizes state-of-the-art cryptography."
62 +HOMEPAGE="https://www.wireguard.com/"
63 +
64 +if [[ ${PV} == 9999 ]]; then
65 + inherit git-r3
66 + EGIT_REPO_URI="https://git.zx2c4.com/wireguard-linux-compat"
67 + KEYWORDS=""
68 +else
69 + SRC_URI="https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${PV}.tar.xz"
70 + S="${WORKDIR}/wireguard-linux-compat-${PV}"
71 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
72 +fi
73 +
74 +LICENSE="GPL-2"
75 +SLOT="0"
76 +IUSE="debug +module module-src"
77 +
78 +DEPEND=""
79 +RDEPEND="${DEPEND} !<=net-vpn/wireguard-0.0.20191219-r1"
80 +
81 +MODULE_NAMES="wireguard(kernel/drivers/net:src)"
82 +BUILD_TARGETS="module"
83 +CONFIG_CHECK="NET INET NET_UDP_TUNNEL CRYPTO_ALGAPI"
84 +
85 +pkg_setup() {
86 + if use module; then
87 + linux-mod_pkg_setup
88 + if kernel_is -lt 3 10 0 || kernel_is -ge 5 6 0; then
89 + die "This version of ${PN} requires 3.10 <= Linux <= 5.5.y"
90 + fi
91 + fi
92 +}
93 +
94 +src_compile() {
95 + BUILD_PARAMS="KERNELDIR=${KERNEL_DIR}"
96 + use debug && BUILD_PARAMS="CONFIG_WIREGUARD_DEBUG=y ${BUILD_PARAMS}"
97 + use module && linux-mod_src_compile
98 +}
99 +
100 +src_install() {
101 + use module && linux-mod_src_install
102 + use module-src && emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src dkms-install
103 +}
104 +
105 +pkg_postinst() {
106 + if use module-src && ! use module; then
107 + einfo
108 + einfo "You have enabled the module-src USE flag without the module USE"
109 + einfo "flag. This means that sources are installed to"
110 + einfo "${ROOT}usr/src/wireguard instead of having the"
111 + einfo "kernel module compiled. You will need to compile the module"
112 + einfo "yourself. Most likely, you don't want this USE flag, and should"
113 + einfo "rather use USE=module"
114 + einfo
115 + fi
116 +
117 + if use module; then
118 + linux-mod_pkg_postinst
119 + local old new
120 + if [[ $(uname -r) != "${KV_FULL}" ]]; then
121 + ewarn
122 + ewarn "You have just built WireGuard for kernel ${KV_FULL}, yet the currently running"
123 + ewarn "kernel is $(uname -r). If you intend to use this WireGuard module on the currently"
124 + ewarn "running machine, you will first need to reboot it into the kernel ${KV_FULL}, for"
125 + ewarn "which this module was built."
126 + ewarn
127 + elif [[ -f /sys/module/wireguard/version ]] && \
128 + old="$(< /sys/module/wireguard/version)" && \
129 + new="$(modinfo -F version "${ROOT}/lib/modules/${KV_FULL}/net/wireguard.ko" 2>/dev/null)" && \
130 + [[ $old != "$new" ]]; then
131 + ewarn
132 + ewarn "You appear to have just upgraded WireGuard from version v$old to v$new."
133 + ewarn "However, the old version is still running on your system. In order to use the"
134 + ewarn "new version, you will need to remove the old module and load the new one. As"
135 + ewarn "root, you can accomplish this with the following commands:"
136 + ewarn
137 + ewarn " # rmmod wireguard"
138 + ewarn " # modprobe wireguard"
139 + ewarn
140 + ewarn "Do note that doing this will remove current WireGuard interfaces, so you may want"
141 + ewarn "to gracefully remove them yourself prior."
142 + ewarn
143 + fi
144 + fi
145 +}
146
147 diff --git a/net-vpn/wireguard-modules/wireguard-modules-9999.ebuild b/net-vpn/wireguard-modules/wireguard-modules-9999.ebuild
148 new file mode 100644
149 index 00000000000..2fe86edba28
150 --- /dev/null
151 +++ b/net-vpn/wireguard-modules/wireguard-modules-9999.ebuild
152 @@ -0,0 +1,93 @@
153 +# Copyright 1999-2019 Gentoo Authors
154 +# Distributed under the terms of the GNU General Public License v2
155 +
156 +EAPI=6
157 +
158 +MODULES_OPTIONAL_USE="module"
159 +inherit linux-mod bash-completion-r1
160 +
161 +DESCRIPTION="Simple yet fast and modern VPN that utilizes state-of-the-art cryptography."
162 +HOMEPAGE="https://www.wireguard.com/"
163 +
164 +if [[ ${PV} == 9999 ]]; then
165 + inherit git-r3
166 + EGIT_REPO_URI="https://git.zx2c4.com/wireguard-linux-compat"
167 + KEYWORDS=""
168 +else
169 + SRC_URI="https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${PV}.tar.xz"
170 + S="${WORKDIR}/wireguard-linux-compat-${PV}"
171 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
172 +fi
173 +
174 +LICENSE="GPL-2"
175 +SLOT="0"
176 +IUSE="debug +module module-src"
177 +
178 +DEPEND=""
179 +RDEPEND="${DEPEND} !<=net-vpn/wireguard-0.0.20191219-r1"
180 +
181 +MODULE_NAMES="wireguard(kernel/drivers/net:src)"
182 +BUILD_TARGETS="module"
183 +CONFIG_CHECK="NET INET NET_UDP_TUNNEL CRYPTO_ALGAPI"
184 +
185 +pkg_setup() {
186 + if use module; then
187 + linux-mod_pkg_setup
188 + if kernel_is -lt 3 10 0 || kernel_is -ge 5 6 0; then
189 + die "This version of ${PN} requires 3.10 <= Linux <= 5.5.y"
190 + fi
191 + fi
192 +}
193 +
194 +src_compile() {
195 + BUILD_PARAMS="KERNELDIR=${KERNEL_DIR}"
196 + use debug && BUILD_PARAMS="CONFIG_WIREGUARD_DEBUG=y ${BUILD_PARAMS}"
197 + use module && linux-mod_src_compile
198 +}
199 +
200 +src_install() {
201 + use module && linux-mod_src_install
202 + use module-src && emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src dkms-install
203 +}
204 +
205 +pkg_postinst() {
206 + if use module-src && ! use module; then
207 + einfo
208 + einfo "You have enabled the module-src USE flag without the module USE"
209 + einfo "flag. This means that sources are installed to"
210 + einfo "${ROOT}usr/src/wireguard instead of having the"
211 + einfo "kernel module compiled. You will need to compile the module"
212 + einfo "yourself. Most likely, you don't want this USE flag, and should"
213 + einfo "rather use USE=module"
214 + einfo
215 + fi
216 +
217 + if use module; then
218 + linux-mod_pkg_postinst
219 + local old new
220 + if [[ $(uname -r) != "${KV_FULL}" ]]; then
221 + ewarn
222 + ewarn "You have just built WireGuard for kernel ${KV_FULL}, yet the currently running"
223 + ewarn "kernel is $(uname -r). If you intend to use this WireGuard module on the currently"
224 + ewarn "running machine, you will first need to reboot it into the kernel ${KV_FULL}, for"
225 + ewarn "which this module was built."
226 + ewarn
227 + elif [[ -f /sys/module/wireguard/version ]] && \
228 + old="$(< /sys/module/wireguard/version)" && \
229 + new="$(modinfo -F version "${ROOT}/lib/modules/${KV_FULL}/net/wireguard.ko" 2>/dev/null)" && \
230 + [[ $old != "$new" ]]; then
231 + ewarn
232 + ewarn "You appear to have just upgraded WireGuard from version v$old to v$new."
233 + ewarn "However, the old version is still running on your system. In order to use the"
234 + ewarn "new version, you will need to remove the old module and load the new one. As"
235 + ewarn "root, you can accomplish this with the following commands:"
236 + ewarn
237 + ewarn " # rmmod wireguard"
238 + ewarn " # modprobe wireguard"
239 + ewarn
240 + ewarn "Do note that doing this will remove current WireGuard interfaces, so you may want"
241 + ewarn "to gracefully remove them yourself prior."
242 + ewarn
243 + fi
244 + fi
245 +}