From a69dae3021edce0eab3c3a0854c4f02565c88362 Mon Sep 17 00:00:00 2001 From: Nyr Date: Wed, 12 Mar 2014 21:06:57 +0100 Subject: [PATCH] Check if the script is running on a Debian-based system before starting Fixed some spacing too --- openvpn-install.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 1afee19..fd39d2d 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -13,8 +13,14 @@ fi if [ ! -e /dev/net/tun ]; then - echo "TUN/TAP is not available" - exit + echo "TUN/TAP is not available" + exit +fi + + +if [ ! -e /etc/debian_version ]; then + echo "Looks like you aren't running this installer on a Debian-based system" + exit fi @@ -23,7 +29,7 @@ fi # and to avoid getting an IPv6. IP=$(ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}' | head -1) if [ "$IP" = "" ]; then - IP=$(wget -qO- ipv4.icanhazip.com) + IP=$(wget -qO- ipv4.icanhazip.com) fi @@ -39,7 +45,7 @@ if [ -e /etc/openvpn/server.conf ]; then echo "3) Remove OpenVPN" echo "4) Exit" echo "" - read -p "Select an option [1-4]:" option + read -p "Select an option [1-4]: " option case $option in 1) echo "" @@ -116,7 +122,7 @@ else echo "" echo "Do you want OpenVPN to be available at port 53 too?" echo "This can be useful to connect under restrictive networks" - read -p "Listen at port 53 [y/n]:" -e -i n ALTPORT + read -p "Listen at port 53 [y/n]: " -e -i n ALTPORT echo "" echo "Finally, tell me your name for the client cert" echo "Please, use one word only, no special characters"