From bf3cccb8fd0bb7ac49b3c9df897be175ee3e282f Mon Sep 17 00:00:00 2001 From: Stanislas Lange Date: Sat, 21 Mar 2020 15:42:14 +0100 Subject: [PATCH] Add warning on Fedora/CentOS when WG is not running because of kernel versions mismatch cf https://github.com/angristan/wireguard-install/issues/30 --- wireguard-install.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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