mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Merge pull request #92 from dschaper/OutsideIP
IP detection update for gravity.sh
This commit is contained in:
commit
11e1859f7d
1 changed files with 3 additions and 1 deletions
|
@ -8,7 +8,9 @@ if [[ -f $piholeIPfile ]];then
|
||||||
rm $piholeIPfile
|
rm $piholeIPfile
|
||||||
else
|
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
|
# 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
|
||||||
piholeIP=$(ip -4 addr show | awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/); ip = substr($0,RSTART,RLENGTH); print ip}' | sed '/^\s*$/d' | grep -v "127.0.0.1" | (head -n1))
|
IPv4dev=$(ip route get 8.8.8.8 | awk '{print $5}')
|
||||||
|
piholeIPCIDR=$(ip -o -f inet addr show dev $IPv4dev | awk '{print $4}')
|
||||||
|
piholeIP=${piholeIPCIDR%/*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ad-list sources--one per line in single quotes
|
# Ad-list sources--one per line in single quotes
|
||||||
|
|
Loading…
Reference in a new issue