aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangristan <angristan@pm.me>2019-05-05 17:47:14 +0200
committerangristan <angristan@pm.me>2019-05-05 17:48:46 +0200
commit14d72d7b22bd2aed7b369d56a6e58a7d11989a2e (patch)
treefdc52aa5f4268b07c256cd4bbe99784e2065e6dd
parentb78610cb982075b66434eff90ad4dd4e363988b9 (diff)
Abort the script if OpenVZ or LXC
Fix #8
-rw-r--r--wireguard-install.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh
index 76ed6d5..598f422 100644
--- a/wireguard-install.sh
+++ b/wireguard-install.sh
@@ -5,6 +5,20 @@ if [ "$EUID" -ne 0 ]; then
exit 1
fi
+if [ "$(systemd-detect-virt)" == "openvz" ]; then
+ echo "OpenVZ is not supported"
+ exit
+fi
+
+if [ "$(systemd-detect-virt)" == "lxc" ]; then
+ echo "LXC is not supported (yet)."
+ echo "WireGuard can techniaclly run in an LXC container,"
+ echo "but the kernel module has to be installed on the host,"
+ echo "the container has to be run with some specific parameters"
+ echo "and only the tools need to be installed in the container."
+ exit
+fi
+
# Detect public IPv4 address and pre-fill for the user
SERVER_PUB_IPV4=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
read -rp "IPv4 or IPv6 public address: " -e -i "$SERVER_PUB_IPV4" SERVER_PUB_IP