1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-06-05 13:00:48 +00:00

Add isRoot()

This commit is contained in:
randomshell 2020-07-01 18:25:55 +00:00
parent 59570c786b
commit 97551d65c1

View File

@ -1,5 +1,12 @@
#!/bin/bash
function isRoot() {
if [ "$EUID" -ne 0 ]; then
echo "You need to run this script as root"
exit 1
fi
}
function addClient() {
# Load params
source /etc/wireguard/params
@ -62,11 +69,6 @@ AllowedIPs = $CLIENT_WG_IPV4/32,$CLIENT_WG_IPV6/128" >>"/etc/wireguard/$SERVER_W
echo "It is also available in $HOME/$SERVER_WG_NIC-client-$CLIENT_NAME.conf"
}
if [ "$EUID" -ne 0 ]; then
echo "You need to run this script as root"
exit 1
fi
if [ "$(systemd-detect-virt)" == "openvz" ]; then
echo "OpenVZ is not supported"
exit