From e14c2359c80f0418967c1ca468a95c10200dfe9b Mon Sep 17 00:00:00 2001 From: Nyr Date: Wed, 20 May 2020 12:09:50 +0200 Subject: [PATCH] Small improvements --- openvpn-install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index e9808a6..b6e1985 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -5,6 +5,9 @@ # Copyright (c) 2013 Nyr. Released under the MIT License. +# Discard stdin. Needed when running from an one-liner which includes a newline +read -N 999999999 -t 0.001 + # Detect Debian users running the script with "sh" instead of bash if readlink /proc/$$/exe | grep -q "dash"; then echo "This script needs to be run with bash, not sh" @@ -16,6 +19,12 @@ if [[ "$EUID" -ne 0 ]]; then exit fi +# Detect OpenVZ 6 +if [[ $(uname -r | cut -d "." -f 1) -eq 2 ]]; then + echo "The system is running an old kernel, which is incompatible with this installer" + exit +fi + # Detect OS # $os_version variables aren't always in use, but are kept here for convenience if grep -qs "ubuntu" /etc/os-release; then @@ -63,6 +72,13 @@ TUN needs to be enabled before running this installer" exit fi +# Detect environments where $PATH does not include the sbin directories +if ! grep -q sbin <<< $PATH; then + echo '$PATH does not include sbin +Try using "su -" instead of "su"' + exit +fi + new_client () { # Generates the custom client.ovpn {