From e3d237a7babde03bdc4bee303a4e11cd00c9048d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 23 Feb 2021 19:33:39 +0100 Subject: net-vpn/wireguard-tools: bump to 1.0.20210223 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Jason A. Donenfeld --- net-vpn/wireguard-tools/Manifest | 1 + .../wireguard-tools-1.0.20210223.ebuild | 116 +++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 net-vpn/wireguard-tools/wireguard-tools-1.0.20210223.ebuild (limited to 'net-vpn') diff --git a/net-vpn/wireguard-tools/Manifest b/net-vpn/wireguard-tools/Manifest index c1aab6fd14c1..3c2c9a12f4d6 100644 --- a/net-vpn/wireguard-tools/Manifest +++ b/net-vpn/wireguard-tools/Manifest @@ -1,2 +1,3 @@ DIST wireguard-tools-1.0.20200513.tar.xz 94500 BLAKE2B 34a39533018416df382d180da76d6494feec1d40208c9df427c1979817dbe138c217fe4c4f4cf5cecd3c4053e6f73f1863d1e0a9ed2cad41899dda5387c15844 SHA512 4d27b262350b6b47843a323c2e7ab8d2bdd48065c265778abdec85b3f6fc92aa9af77d76e368df9cc8e435eae1c0ce50fed52e1d78db54358c1884d34be08d2c DIST wireguard-tools-1.0.20200827.tar.xz 94788 BLAKE2B d7d881a56819c028b37c11b9a44e3304a0f49250aa6ce3da894802dc2546b755f790ddd3fbc14ec1e0f653ead744434ee540c20226373122d131d7deeae94544 SHA512 843b70050d24f142262b672daee44cdccab508b52f42b19a32c275a17d40fd8fb66136a22ef2a4602217e821703bb36a261e474b465807308f52e6a0ee49e267 +DIST wireguard-tools-1.0.20210223.tar.xz 95444 BLAKE2B 59606684c08893c40ac14f9d021013c741f1ea80dc5a07946ec2597d8c91f6c8e1ebbc5714d04ea6d7d9356362a9d5598a578019ead38a2e327a2162d1d1a9af SHA512 98855853a3ecfce23a0a6bf4a885c85efaf2b08c9a92e0d3800fe40ae9adf05fdf4443150a71319bd9b53e314c8032694ea978db850a238813232a0c04edf692 diff --git a/net-vpn/wireguard-tools/wireguard-tools-1.0.20210223.ebuild b/net-vpn/wireguard-tools/wireguard-tools-1.0.20210223.ebuild new file mode 100644 index 000000000000..b0ff48c21a8f --- /dev/null +++ b/net-vpn/wireguard-tools/wireguard-tools-1.0.20210223.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2021 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 +} -- cgit v1.2.3-65-gdbad