From 424b69cd607b049f3715459bb8c36df2e74be41e Mon Sep 17 00:00:00 2001 From: Angristan Date: Sun, 19 Aug 2018 01:03:35 +0200 Subject: [PATCH] Add getNIC () --- openvpn-install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index d414f05..dff1c2b 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -81,6 +81,10 @@ function initialCheck () { checkOS } +function getNIC () { + return $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) +} + function newclient () { echo "" echo "Do you want to protect the configuration file with a password?" @@ -152,7 +156,7 @@ function newclient () { initialCheck # Get Internet network interface with default route -NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) +NIC=$(getNIC) if [[ -e /etc/openvpn/server.conf ]]; then while :