mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 17:13:17 +00:00
check for a static IP from tmp file
Using the new installation script, if a user wants a static IP address, it is temporarily stored in /tmp/piholeIP. This file needs to be read so the value can be used in the gravity script.
This commit is contained in:
parent
08d6b8a67a
commit
5d66f0ede1
1 changed files with 18 additions and 11 deletions
13
gravity.sh
13
gravity.sh
|
@ -1,11 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# http://pi-hole.net
|
# http://pi-hole.net
|
||||||
# Compiles a list of ad-serving domains by downloading them from multiple sources
|
# Compiles a list of ad-serving domains by downloading them from multiple sources
|
||||||
|
piholeIPfile=/tmp/piholeIP
|
||||||
# This script should only be run after you have a static IP address set on the Pi
|
if [[ -f $piholeIPfile ]];then
|
||||||
piholeIP=$(hostname -I)
|
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||||
|
piholeIP=$(cat $piholeIPfile)
|
||||||
|
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
|
||||||
|
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")
|
||||||
|
fi
|
||||||
|
|
||||||
# Ad-list sources--one per line in single quotes
|
# Ad-list sources--one per line in single quotes
|
||||||
|
# The mahakala source is commented out due to many users having issues with it blocking legitimate domains. Uncomment at your own risk
|
||||||
sources=('https://adaway.org/hosts.txt'
|
sources=('https://adaway.org/hosts.txt'
|
||||||
'http://adblock.gjtech.net/?format=unix-hosts'
|
'http://adblock.gjtech.net/?format=unix-hosts'
|
||||||
#'http://adblock.mahakala.is/'
|
#'http://adblock.mahakala.is/'
|
||||||
|
|
Loading…
Reference in a new issue