Skip to content

Commit

Permalink
Add warning on Fedora/CentOS when WG is not running because of kernel…
Browse files Browse the repository at this point in the history
… versions mismatch

cf #30
  • Loading branch information
angristan committed Mar 21, 2020
1 parent b9da4d0 commit bf3cccb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion wireguard-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bf3cccb

Please sign in to comment.