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 2 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
44 changes: 44 additions & 0 deletions debian/wireguard-dkms.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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
echo "WARNING: kernel module is not loaded"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this WARNING, since the kernel module is loaded ondemand.

However, you do need the exit 0 below, so keep that.

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. As"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 "root, 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