1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-11-21 20:25:14 +00:00

Add more colors + warning to reboot on install

Might help for https://github.com/angristan/wireguard-install/issues/377
This commit is contained in:
Stanislas Lange 2023-01-22 12:18:42 +01:00
parent 3c7c8535d0
commit 77185dcdf8
No known key found for this signature in database

View File

@ -5,6 +5,7 @@
RED='\033[0;31m' RED='\033[0;31m'
ORANGE='\033[0;33m' ORANGE='\033[0;33m'
GREEN='\033[0;32m'
NC='\033[0m' NC='\033[0m'
function isRoot() { function isRoot() {
@ -253,7 +254,7 @@ net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf
systemctl enable "wg-quick@${SERVER_WG_NIC}" systemctl enable "wg-quick@${SERVER_WG_NIC}"
newClient 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 # Check if WireGuard is running
systemctl is-active --quiet "wg-quick@${SERVER_WG_NIC}" 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 "\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}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}" 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 fi
} }
@ -355,11 +360,12 @@ AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"/etc/wireguard/${SER
# Generate QR code if qrencode is installed # Generate QR code if qrencode is installed
if command -v qrencode &>/dev/null; then 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" qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
echo ""
fi 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() { function listClients() {