Skip to content

Instantly share code, notes, and snippets.

@EggieCode
Created September 14, 2017 18:47
Show Gist options
  • Save EggieCode/45443b7ccfff5d9f0477185c7815b3f3 to your computer and use it in GitHub Desktop.
Save EggieCode/45443b7ccfff5d9f0477185c7815b3f3 to your computer and use it in GitHub Desktop.
fix linux mint
#!/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
if [ ! -f "/lib/modules/$(uname -r)/updates/dkms/wireguard.ko" ]; 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment