From 9609b0b7b5ebcc3f5d7956e886241273e011be83 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Tue, 19 Jan 2016 01:26:12 -0600 Subject: [PATCH] Add check for network interface eth0 --- vpnsetup.sh | 6 ++++++ vpnsetup_centos.sh | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/vpnsetup.sh b/vpnsetup.sh index d526dcb..462cfb4 100644 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -49,6 +49,12 @@ if [ "$(id -u)" != 0 ]; then exit 1 fi +# Make sure "eth0" is available +if [ ! -f /sys/class/net/eth0/operstate ]; then + echo "Network interface 'eth0' is not available. Aborting." + exit 1 +fi + # Check for empty VPN variables if [ -z "$IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then echo "The VPN credentials cannot be empty. Please re-edit the VPN script." diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 80c4c8b..558089c 100644 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -58,6 +58,15 @@ if [ "$(id -u)" != 0 ]; then exit 1 fi +# Make sure "eth0" is available +if [ ! -f /sys/class/net/eth0/operstate ]; then + echo "Network interface 'eth0' is not available. Aborting." + echo + echo "CentOS 7 users should change interfaces to use the old naming convention" + echo "before running this script. See: https://wiki.centos.org/FAQ/CentOS7" + exit 1 +fi + # Check for empty VPN variables if [ -z "$IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then echo "The VPN credentials cannot be empty. Please re-edit the VPN script."