diff options
author | Stanislas Lange <stanislas.lange@pm.me> | 2021-03-18 14:31:30 +0100 |
---|---|---|
committer | Stanislas Lange <stanislas.lange@pm.me> | 2021-03-18 14:31:30 +0100 |
commit | 5c41fa0ab554e16912dff1c7649a0045f615a161 (patch) | |
tree | 898a5e8d53a4e573f61599174d38bdddef763137 | |
parent | bd37d606f1c77a3c74c8fe76d21ac0db1391d64c (diff) |
Be very explicit when WireGuard is not running
-rw-r--r-- | wireguard-install.sh | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh index 68585b1..779246c 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -3,6 +3,10 @@ # Secure WireGuard server installer for Debian, Ubuntu, CentOS, Fedora and Arch Linux # https://github.com/angristan/wireguard-install +RED='\033[0;31m' +ORANGE='\033[0;33m' +NC='\033[0m' + function isRoot() { if [ "${EUID}" -ne 0 ]; then echo "You need to run this script as root" @@ -199,19 +203,19 @@ net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf systemctl start "wg-quick@${SERVER_WG_NIC}" systemctl enable "wg-quick@${SERVER_WG_NIC}" + newClient + echo "If you want to add more clients, you simply need to run this script another time!" + # Check if WireGuard is running systemctl is-active --quiet "wg-quick@${SERVER_WG_NIC}" WG_RUNNING=$? # WireGuard might not work if we updated the kernel. Tell the user to reboot if [[ ${WG_RUNNING} -ne 0 ]]; then - echo -e "\nWARNING: WireGuard does not seem to be running." - 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 ${SERVER_WG_NIC}\", please reboot!" + echo -e "\n${RED}WARNING: WireGuard does not seem to be running.${NC}" + echo -e "${ORANGE}You can check if WireGuard is running with: systemctl status wg-quick@${SERVER_WG_NIC}${NC}" + echo -e "${ORANGE}If you get something like \"Cannot find device ${SERVER_WG_NIC}\", please reboot!${NC}" fi - - newClient - echo "If you want to add more clients, you simply need to run this script another time!" } function newClient() { |