From 77185dcdf8ae735adc8dafab67536dab66abadac Mon Sep 17 00:00:00 2001 From: Stanislas Lange Date: Sun, 22 Jan 2023 12:18:42 +0100 Subject: [PATCH] Add more colors + warning to reboot on install Might help for https://github.com/angristan/wireguard-install/issues/377 --- wireguard-install.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index f13b88e..b90b68e 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -5,6 +5,7 @@ RED='\033[0;31m' ORANGE='\033[0;33m' +GREEN='\033[0;32m' NC='\033[0m' function isRoot() { @@ -253,7 +254,7 @@ net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf 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!" + echo -e "${GREEN}If you want to add more clients, you simply need to run this script another time!${NC}" # Check if WireGuard is running systemctl is-active --quiet "wg-quick@${SERVER_WG_NIC}" @@ -264,6 +265,10 @@ net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf 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}" + else # WireGuard is running + echo -e "\n${GREEN}WireGuard is running.${NC}" + echo -e "${GREEN}You can check the status of WireGuard with: systemctl status wg-quick@${SERVER_WG_NIC}\n\n${NC}" + echo -e "${ORANGE}If you don't have internet connectivity from your client, try to reboot the server.${NC}" fi } @@ -355,11 +360,12 @@ AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"/etc/wireguard/${SER # Generate QR code if qrencode is installed if command -v qrencode &>/dev/null; then - echo -e "\nHere is your client config file as a QR Code:" + echo -e "${GREEN}\nHere is your client config file as a QR Code:\n${NC}" qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf" + echo "" fi - echo "It is also available in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf" + echo -e "${GREEN}Your client config file is in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf${NC}" } function listClients() {