Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Added a message over the update of the module #24

Merged
merged 4 commits into from
Aug 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions debian/wireguard-dkms.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
set -e

#DEBHELPER#

# Message of running rmmod & modprobe need to run after the module has been build.

case "$1" in
install)
;;

configure)
# Check if the wireguard module is loaded else the install will fail.
if [ ! -f "/sys/module/wireguard/version" ]; then
exit 0
fi


new="$(modinfo -F version "/lib/modules/$(uname -r)/updates/dkms/wireguard.ko" 2>/dev/null)" # Get the version of the current builded module
old=`cat /sys/module/wireguard/version` # Get the version of the current loaded module
if ! [ "$old" = "$new" ]; then
echo "You appear to have just upgraded WireGuard from version v$old to v$new."
echo "However, the old version is still running on your system. In order to use the"
echo "new version, you will need to remove the old module and load the new one."
echo "You can accomplish this with the following commands:"
echo
echo " # sudo rmmod wireguard"
echo " # sudo modprobe wireguard"
echo
echo "Do note that doing this will remove current WireGuard interfaces, so you may want"
echo "to gracefully remove them yourself prior."
fi
;;
abort-upgrade)
;;
*)
exit 0
;;
esac


exit 0