net-vpn/wireguard-tools: add missing info from monolithic ebuild
authorJason A. Donenfeld <zx2c4@gentoo.org>
Thu, 26 Dec 2019 16:40:15 +0000 (17:40 +0100)
committerJason A. Donenfeld <zx2c4@gentoo.org>
Thu, 26 Dec 2019 16:47:16 +0000 (17:47 +0100)
Package-Manager: Portage-2.3.83, Repoman-2.3.20
Signed-off-by: Jason A. Donenfeld <zx2c4@gentoo.org>
net-vpn/wireguard-tools/wireguard-tools-1.0.20191226.ebuild
net-vpn/wireguard-tools/wireguard-tools-9999.ebuild

index db33e8d6af8ae9e3bb2b93fbcf32f2e6177c30c0..700f6f9b03e9faba07056039e158ec839f4a09a0 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit bash-completion-r1
+inherit linux-mod bash-completion-r1
 
 DESCRIPTION="Required tools for WireGuard, such as wg(8) and wg-quick(8)"
 HOMEPAGE="https://www.wireguard.com/"
@@ -26,6 +26,21 @@ RDEPEND="${DEPEND}
        !<=net-vpn/wireguard-0.0.20191219
 "
 
+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() {
+       wg_quick_optional_config_nob IP_ADVANCED_ROUTER
+       wg_quick_optional_config_nob IP_MULTIPLE_TABLES
+       wg_quick_optional_config_nob NETFILTER_XT_MARK
+       wg_quick_optional_config_nob NETFILTER_XT_CONNMARK
+       wg_quick_optional_config_nob IP6_NF_RAW
+       wg_quick_optional_config_nob IP_NF_RAW
+       linux-mod_pkg_setup
+}
+
 src_compile() {
        emake RUNSTATEDIR="${EPREFIX}/run" -C src CC="$(tc-getCC)" LD="$(tc-getLD)"
 }
@@ -42,3 +57,26 @@ src_install() {
                PREFIX="${EPREFIX}/usr" \
                -C src install
 }
+
+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 "If you'd like to redirect your internet traffic, you can run it with the"
+       einfo "\"default-route\" argument. You may not use this server for any abusive or illegal"
+       einfo "purposes. It is for quick testing only."
+       einfo
+       einfo "More info on getting started can be found at: https://www.wireguard.com/quickstart/"
+       einfo
+}
index db33e8d6af8ae9e3bb2b93fbcf32f2e6177c30c0..700f6f9b03e9faba07056039e158ec839f4a09a0 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit bash-completion-r1
+inherit linux-mod bash-completion-r1
 
 DESCRIPTION="Required tools for WireGuard, such as wg(8) and wg-quick(8)"
 HOMEPAGE="https://www.wireguard.com/"
@@ -26,6 +26,21 @@ RDEPEND="${DEPEND}
        !<=net-vpn/wireguard-0.0.20191219
 "
 
+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() {
+       wg_quick_optional_config_nob IP_ADVANCED_ROUTER
+       wg_quick_optional_config_nob IP_MULTIPLE_TABLES
+       wg_quick_optional_config_nob NETFILTER_XT_MARK
+       wg_quick_optional_config_nob NETFILTER_XT_CONNMARK
+       wg_quick_optional_config_nob IP6_NF_RAW
+       wg_quick_optional_config_nob IP_NF_RAW
+       linux-mod_pkg_setup
+}
+
 src_compile() {
        emake RUNSTATEDIR="${EPREFIX}/run" -C src CC="$(tc-getCC)" LD="$(tc-getLD)"
 }
@@ -42,3 +57,26 @@ src_install() {
                PREFIX="${EPREFIX}/usr" \
                -C src install
 }
+
+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 "If you'd like to redirect your internet traffic, you can run it with the"
+       einfo "\"default-route\" argument. You may not use this server for any abusive or illegal"
+       einfo "purposes. It is for quick testing only."
+       einfo
+       einfo "More info on getting started can be found at: https://www.wireguard.com/quickstart/"
+       einfo
+}