From 6010d1dbf6ac4063f5ffb405264e541016c1f088 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 16 Nov 2023 07:49:56 -0600 Subject: [PATCH] Update defaults.inc --- defaults.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/defaults.inc b/defaults.inc index 7bd6c44c..32c1ea22 100755 --- a/defaults.inc +++ b/defaults.inc @@ -114,7 +114,15 @@ NM_LOGFILE=${NM_LOGFOLDER}/logfile NM_WANDNS='wdns.scity.us' NM_LANDNS='ldns.scity.us' -TSI=$(ip link | grep tailscale0) && [ ${#TSI} != 0 ] && RUN_NODE_TSIP=$(ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || RUN_NODE_TSIP= +# TSI=$(ip link | grep tailscale0) +# if [ ${#TSI} != 0 ]; then +# RUN_NODE_TSIP=$(ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) +# else +# RUN_NODE_TSIP=[ "$(ip route | awk '/default/ { print $5 }')" == "link" ] +# RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) || +# RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) + +TSI=$(/sbin/ip link | grep tailscale0) && [ ${#TSI} != 0 ] && RUN_NODE_TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || RUN_NODE_TSIP= [ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) || RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) @@ -126,7 +134,7 @@ else var=${NTYPE}_HOSTS[@] RUN_NODE_TYPE="" for nip in "${!var}"; do - # echo "${NTYPE} - $nip - ${RUN_NODE_IP} - ${RUN_NODE_TSIP}" + echo "${NTYPE} - $nip - ${RUN_NODE_IP} - ${RUN_NODE_TSIP}" if [[ "${RUN_NODE_IP}" == *"${nip}"* ]]; then RUN_NODE_TYPE=${NTYPE}; RUN_NODE_IP=${RUN_NODE_IP}