From a193f5ad78165de70e86c81e600e84bb4a15fe78 Mon Sep 17 00:00:00 2001 From: randomshell Date: Sat, 22 Aug 2020 20:26:21 +0000 Subject: [PATCH] Allow a default IPv6 NIC Missed to commit in the refactor PR --- wireguard-install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wireguard-install.sh b/wireguard-install.sh index b5739a9..063a2ce 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -80,6 +80,9 @@ function installQuestions() { # Detect public interface and pre-fill for the user SERVER_NIC=${SERVER_NIC:-$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)} + if [[ -z $SERVER_NIC ]]; then + SERVER_NIC=$(ip -6 route show default | sed -ne 's/^default .* dev \([^ ]*\) .*$/\1/p') + fi APPROVE_NIC=${APPROVE_NIC:-n} until [[ ${SERVER_PUB_NIC} =~ ^[a-zA-Z0-9_]+$ || ${APPROVE_NIC} =~ n ]]; do read -rp "Public interface: " -e -i "${SERVER_NIC}" SERVER_PUB_NIC