Update start.sh to get the INTERNAL_IP of systems that don't have '-I' as an option for hostname function

This commit is contained in:
Justin Trujillo 2022-05-24 01:48:06 -06:00
parent 449630bf5f
commit 3c1c2b6ba4

View file

@ -52,10 +52,16 @@ if [[ "$(uname)" != "Linux" ]]; then
exit 1
fi
function host_check {
INTERNAL_IP="$(hostname -I 2>&1| awk '{print $1}')"
if [ '$(grep -q "hostname: invalid option $IP' ]; then
INTERNAL_IP="$(ip route show | grep -i default | awk -F' ' '{print $9}')"
fi
}
host_check
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
STATE_FOLDER="${ROOT_FOLDER}/state"
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
INTERNAL_IP="$(hostname -I | awk '{print $1}')"
DNS_IP=9.9.9.9 # Default to Quad9 DNS
ARCHITECTURE="$(uname -m)"