aboutsummaryrefslogtreecommitdiff
path: root/wireguard-install.sh
diff options
context:
space:
mode:
authorStanislas Lange <angristan@pm.me>2020-03-21 15:42:14 +0100
committerStanislas Lange <angristan@pm.me>2020-03-21 15:42:14 +0100
commitbf3cccb8fd0bb7ac49b3c9df897be175ee3e282f (patch)
tree6a032c72abe51a53a588e7cd047b3f8ea354b79b /wireguard-install.sh
parentb9da4d03cdac26430737ed1cbaed37bfb66e8c9f (diff)
Add warning on Fedora/CentOS when WG is not running because of kernel versions mismatch
cf https://github.com/angristan/wireguard-install/issues/30
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r--wireguard-install.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh
index 08ffd93..5663a22 100644
--- a/wireguard-install.sh
+++ b/wireguard-install.sh
@@ -161,6 +161,23 @@ sysctl --system
systemctl start "wg-quick@$SERVER_WG_NIC"
systemctl enable "wg-quick@$SERVER_WG_NIC"
-echo "Here is your client config file as a QR Code:"
+echo -e "\nHere is your client config file as a QR Code:"
qrencode -t ansiutf8 -l L < "$HOME/$SERVER_WG_NIC-client.conf"
+
+# Check if WireGuard is running
+systemctl is-active --quiet wg-quick@$SERVER_WG_NIC
+WG_RUNNING=$?
+
+# Warn user about kernel version mismatch with headers
+if [[ "$OS" =~ (fedora|centos) ]] && [[ $WG_RUNNING -ne 0 ]]; then
+ echo -e "\nWARNING: WireGuard does not seem to be running."
+ echo "Due to kernel mismatch issues on $OS, WireGuard might work if your system is out of date."
+ echo "You can check if WireGuard is running with: systemctl status wg-quick@$SERVER_WG_NIC"
+ echo "If you get something like \"Cannot find device wg0\", please run:"
+ if [[ "$OS" = 'fedora' ]]; then
+ echo "dnf update -y && reboot"
+ elif [[ "$OS" = 'centos' ]]; then
+ echo "yum update -y && reboot"
+ fi
+fi