commit:     67e3569a9c805ad4887cd8a91561272c13f6c02a
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  8 00:14:24 2017 +0000
Commit:     Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Tue Aug  8 22:47:18 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67e3569a

net-vpn/wireguard: give advice to rmmod

Package-Manager: Portage-2.3.6, Repoman-2.3.3

 net-vpn/wireguard/wireguard-0.0.20170726.ebuild | 41 ++++++++++++++++++++-----
 net-vpn/wireguard/wireguard-9999.ebuild         | 41 ++++++++++++++++++++-----
 2 files changed, 68 insertions(+), 14 deletions(-)

diff --git a/net-vpn/wireguard/wireguard-0.0.20170726.ebuild 
b/net-vpn/wireguard/wireguard-0.0.20170726.ebuild
index ff291933ed8..d3b45bd83e1 100644
--- a/net-vpn/wireguard/wireguard-0.0.20170726.ebuild
+++ b/net-vpn/wireguard/wireguard-0.0.20170726.ebuild
@@ -76,13 +76,13 @@ pkg_postinst() {
        fi
        use module && linux-mod_pkg_postinst
 
-       ewarn
-       ewarn "This software is experimental and has not yet been released."
-       ewarn "As such, it may contain significant issues. Please do not file"
-       ewarn "bug reports with Gentoo, but rather direct them upstream to:"
-       ewarn
-       ewarn "    t...@wireguard.io    secur...@wireguard.io"
-       ewarn
+       einfo
+       einfo "This software is experimental and has not yet been released."
+       einfo "As such, it may contain significant issues. Please do not file"
+       einfo "bug reports with Gentoo, but rather direct them upstream to:"
+       einfo
+       einfo "    t...@wireguard.io    secur...@wireguard.io"
+       einfo
 
        if use tools; then
                einfo
@@ -106,4 +106,31 @@ pkg_postinst() {
                einfo "More info on getting started can be found at: 
https://www.wireguard.io/quickstart/";
                einfo
        fi
+       if use module; then
+               local old new
+               if [[ $(uname -r) != "${KV_FULL}" ]]; then
+                       ewarn
+                       ewarn "You have just built WireGuard for kernel 
${KV_FULL}, yet the currently running"
+                       ewarn "kernel is $(uname -r). If you intend to use this 
WireGuard module on the currently"
+                       ewarn "running machine, you will first need to reboot 
it into the kernel ${KV_FULL}, for"
+                       ewarn "which this module was built."
+                       ewarn
+               elif [[ -f /sys/module/wireguard/version ]] && \
+                    old="$(< /sys/module/wireguard/version)" && \
+                    new="$(modinfo -F version 
"${ROOT}/lib/modules/${KV_FULL}/net/wireguard.ko" 2>/dev/null)" && \
+                    [[ $old != "$new" ]]; then
+                       ewarn
+                       ewarn "You appear to have just upgraded WireGuard from 
version v$old to v$new."
+                       ewarn "However, the old version is still running on 
your system. In order to use the"
+                       ewarn "new version, you will need to remove the old 
module and load the new one. As"
+                       ewarn "root, you can accomplish this with the following 
commands:"
+                       ewarn
+                       ewarn "    # rmmod wireguard"
+                       ewarn "    # modprobe wireguard"
+                       ewarn
+                       ewarn "Do note that doing this will remove current 
WireGuard interfaces, so you may want"
+                       ewarn "to gracefully remove them yourself prior."
+                       ewarn
+               fi
+       fi
 }

diff --git a/net-vpn/wireguard/wireguard-9999.ebuild 
b/net-vpn/wireguard/wireguard-9999.ebuild
index ff291933ed8..d3b45bd83e1 100644
--- a/net-vpn/wireguard/wireguard-9999.ebuild
+++ b/net-vpn/wireguard/wireguard-9999.ebuild
@@ -76,13 +76,13 @@ pkg_postinst() {
        fi
        use module && linux-mod_pkg_postinst
 
-       ewarn
-       ewarn "This software is experimental and has not yet been released."
-       ewarn "As such, it may contain significant issues. Please do not file"
-       ewarn "bug reports with Gentoo, but rather direct them upstream to:"
-       ewarn
-       ewarn "    t...@wireguard.io    secur...@wireguard.io"
-       ewarn
+       einfo
+       einfo "This software is experimental and has not yet been released."
+       einfo "As such, it may contain significant issues. Please do not file"
+       einfo "bug reports with Gentoo, but rather direct them upstream to:"
+       einfo
+       einfo "    t...@wireguard.io    secur...@wireguard.io"
+       einfo
 
        if use tools; then
                einfo
@@ -106,4 +106,31 @@ pkg_postinst() {
                einfo "More info on getting started can be found at: 
https://www.wireguard.io/quickstart/";
                einfo
        fi
+       if use module; then
+               local old new
+               if [[ $(uname -r) != "${KV_FULL}" ]]; then
+                       ewarn
+                       ewarn "You have just built WireGuard for kernel 
${KV_FULL}, yet the currently running"
+                       ewarn "kernel is $(uname -r). If you intend to use this 
WireGuard module on the currently"
+                       ewarn "running machine, you will first need to reboot 
it into the kernel ${KV_FULL}, for"
+                       ewarn "which this module was built."
+                       ewarn
+               elif [[ -f /sys/module/wireguard/version ]] && \
+                    old="$(< /sys/module/wireguard/version)" && \
+                    new="$(modinfo -F version 
"${ROOT}/lib/modules/${KV_FULL}/net/wireguard.ko" 2>/dev/null)" && \
+                    [[ $old != "$new" ]]; then
+                       ewarn
+                       ewarn "You appear to have just upgraded WireGuard from 
version v$old to v$new."
+                       ewarn "However, the old version is still running on 
your system. In order to use the"
+                       ewarn "new version, you will need to remove the old 
module and load the new one. As"
+                       ewarn "root, you can accomplish this with the following 
commands:"
+                       ewarn
+                       ewarn "    # rmmod wireguard"
+                       ewarn "    # modprobe wireguard"
+                       ewarn
+                       ewarn "Do note that doing this will remove current 
WireGuard interfaces, so you may want"
+                       ewarn "to gracefully remove them yourself prior."
+                       ewarn
+               fi
+       fi
 }

Reply via email to