From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1198115-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id C8DC3138359
	for <garchives@archives.gentoo.org>; Thu, 20 Aug 2020 10:13:50 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E052CE0C3F;
	Thu, 20 Aug 2020 10:13:49 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B7689E0C3F
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Aug 2020 10:13:49 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 595C934F1EF
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Aug 2020 10:13:48 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id C1FB030A
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Aug 2020 10:13:46 +0000 (UTC)
From: "Jason A. Donenfeld" <zx2c4@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Jason A. Donenfeld" <zx2c4@gentoo.org>
Message-ID: <1597918403.f7a861be8c3e6c7f6086761f4a2f21c582b2144c.zx2c4@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-vpn/wireguard-tools/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-vpn/wireguard-tools/Manifest net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild
X-VCS-Directories: net-vpn/wireguard-tools/
X-VCS-Committer: zx2c4
X-VCS-Committer-Name: Jason A. Donenfeld
X-VCS-Revision: f7a861be8c3e6c7f6086761f4a2f21c582b2144c
X-VCS-Branch: master
Date: Thu, 20 Aug 2020 10:13:46 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 2acc167c-0369-4b90-b26a-4d0505448b7e
X-Archives-Hash: 672b756d1d09a245dfc72faca1b74ee4

commit:     f7a861be8c3e6c7f6086761f4a2f21c582b2144c
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 20 10:13:04 2020 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 20 10:13:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7a861be

net-vpn/wireguard-tools: version bump

Package-Manager: Portage-3.0.3, Repoman-3.0.0
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 net-vpn/wireguard-tools/Manifest                   |   1 +
 .../wireguard-tools-1.0.20200820.ebuild            | 116 +++++++++++++++++++++
 2 files changed, 117 insertions(+)

diff --git a/net-vpn/wireguard-tools/Manifest b/net-vpn/wireguard-tools/Manifest
index b60ce915a97..20a8ba1966f 100644
--- a/net-vpn/wireguard-tools/Manifest
+++ b/net-vpn/wireguard-tools/Manifest
@@ -1 +1,2 @@
 DIST wireguard-tools-1.0.20200513.tar.xz 94500 BLAKE2B 34a39533018416df382d180da76d6494feec1d40208c9df427c1979817dbe138c217fe4c4f4cf5cecd3c4053e6f73f1863d1e0a9ed2cad41899dda5387c15844 SHA512 4d27b262350b6b47843a323c2e7ab8d2bdd48065c265778abdec85b3f6fc92aa9af77d76e368df9cc8e435eae1c0ce50fed52e1d78db54358c1884d34be08d2c
+DIST wireguard-tools-1.0.20200820.tar.xz 94812 BLAKE2B 68e3db7cc337e8cf0b35d192f38d6303696c19956661a10d253241864a8b22c666b99ea62d9533bc661353c77a7df4333e336ee00235d9492347beaf58b78396 SHA512 d30ff3c4381e65cd0a751110e66f3ad1aa274b22962da748af6373210d3e4824d066a74655156d7a3d1fe6f96187a49408bc590a8023bc706c1824c0546b874c

diff --git a/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild b/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild
new file mode 100644
index 00000000000..f61364d1c25
--- /dev/null
+++ b/net-vpn/wireguard-tools/wireguard-tools-1.0.20200820.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit linux-info bash-completion-r1 systemd toolchain-funcs
+
+DESCRIPTION="Required tools for WireGuard, such as wg(8) and wg-quick(8)"
+HOMEPAGE="https://www.wireguard.com/"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://git.zx2c4.com/wireguard-tools"
+else
+	SRC_URI="https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${PV}.tar.xz"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="+wg-quick"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND=""
+RDEPEND="${DEPEND}
+	wg-quick? (
+		|| ( net-firewall/nftables net-firewall/iptables )
+		virtual/resolvconf
+	)
+"
+
+wg_quick_optional_config_nob() {
+	CONFIG_CHECK="$CONFIG_CHECK ~$1"
+	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."
+}
+
+pkg_setup() {
+	if use wg-quick; then
+		wg_quick_optional_config_nob IP_ADVANCED_ROUTER
+		wg_quick_optional_config_nob IP_MULTIPLE_TABLES
+		wg_quick_optional_config_nob IPV6_MULTIPLE_TABLES
+		if has_version net-firewall/nftables; then
+			wg_quick_optional_config_nob NF_TABLES
+			wg_quick_optional_config_nob NF_TABLES_IPV4
+			wg_quick_optional_config_nob NF_TABLES_IPV6
+			wg_quick_optional_config_nob NFT_CT
+			wg_quick_optional_config_nob NFT_FIB
+			wg_quick_optional_config_nob NFT_FIB_IPV4
+			wg_quick_optional_config_nob NFT_FIB_IPV6
+			wg_quick_optional_config_nob NF_CONNTRACK_MARK
+		elif has_version net-firewall/iptables; then
+			wg_quick_optional_config_nob NETFILTER_XTABLES
+			wg_quick_optional_config_nob NETFILTER_XT_MARK
+			wg_quick_optional_config_nob NETFILTER_XT_CONNMARK
+			wg_quick_optional_config_nob NETFILTER_XT_MATCH_COMMENT
+			wg_quick_optional_config_nob NETFILTER_XT_MATCH_ADDRTYPE
+			wg_quick_optional_config_nob IP6_NF_RAW
+			wg_quick_optional_config_nob IP_NF_RAW
+			wg_quick_optional_config_nob IP6_NF_FILTER
+			wg_quick_optional_config_nob IP_NF_FILTER
+		fi
+	fi
+	get_version
+	if [[ -f $KERNEL_DIR/include/uapi/linux/wireguard.h ]]; then
+		CONFIG_CHECK="~WIREGUARD $CONFIG_CHECK"
+		declare -g ERROR_WIREGUARD="CONFIG_WIREGUARD: This option is required for using WireGuard."
+	elif kernel_is -ge 3 10 0 && kernel_is -lt 5 6 0 && ! has_version net-vpn/wireguard-modules; then
+		ewarn
+		ewarn "Your kernel does not appear to have upstream support for WireGuard"
+		ewarn "via CONFIG_WIREGUARD. However, the net-vpn/wireguard-modules ebuild"
+		ewarn "contains a compatibility module that should work for your kernel."
+		ewarn "It is highly recommended to install it:"
+		ewarn
+		ewarn "    emerge -av net-vpn/wireguard-modules"
+		ewarn
+	fi
+	linux-info_pkg_setup
+}
+
+src_compile() {
+	emake RUNSTATEDIR="${EPREFIX}/run" -C src CC="$(tc-getCC)" LD="$(tc-getLD)"
+}
+
+src_install() {
+	dodoc README.md
+	dodoc -r contrib
+	emake \
+		WITH_BASHCOMPLETION=yes \
+		WITH_SYSTEMDUNITS=yes \
+		WITH_WGQUICK=$(usex wg-quick) \
+		DESTDIR="${D}" \
+		BASHCOMPDIR="$(get_bashcompdir)" \
+		SYSTEMDUNITDIR="$(systemd_get_systemunitdir)" \
+		PREFIX="${EPREFIX}/usr" \
+		-C src install
+	use wg-quick && newinitd "${FILESDIR}/wg-quick.init" wg-quick
+}
+
+pkg_postinst() {
+	einfo
+	einfo "After installing WireGuard, if you'd like to try sending some packets through"
+	einfo "WireGuard, you may use, for testing purposes only, the insecure client.sh"
+	einfo "test example script:"
+	einfo
+	einfo "  \$ bzcat ${ROOT}/usr/share/doc/${PF}/contrib/ncat-client-server/client.sh.bz2 | sudo bash -"
+	einfo
+	einfo "This will automatically setup interface wg0, through a very insecure transport"
+	einfo "that is only suitable for demonstration purposes. You can then try loading the"
+	einfo "hidden website or sending pings:"
+	einfo
+	einfo "  \$ chromium http://192.168.4.1"
+	einfo "  \$ ping 192.168.4.1"
+	einfo
+	einfo "More info on getting started can be found at: https://www.wireguard.com/quickstart/"
+	einfo
+}