From b391afef49a589d5d1aa9a5a3e33add78f3a3372 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sun, 6 Dec 2015 04:45:04 -0800 Subject: [PATCH 1/2] Interface pull for multiple platforms --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 2598baa..e097f70 100755 --- a/gravity.sh +++ b/gravity.sh @@ -12,7 +12,7 @@ if [[ -f $piholeIPfile ]];then rm $piholeIPfile else # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script - IPv4dev=$(ip route get 8.8.8.8 | awk '{print $5}') + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}') | awk 'END {print}') piholeIP=${piholeIPCIDR%/*} fi From a230df00320fb3a257cb41fcbbf829d8b4bec4d1 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sun, 6 Dec 2015 05:33:22 -0800 Subject: [PATCH 2/2] Fix errant ) --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index e097f70..66df1e3 100755 --- a/gravity.sh +++ b/gravity.sh @@ -13,7 +13,7 @@ if [[ -f $piholeIPfile ]];then else # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') - piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}') | awk 'END {print}') + piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}' | awk 'END {print}') piholeIP=${piholeIPCIDR%/*} fi