mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Merged branch development into PiHoleController
This commit is contained in:
commit
767b72fbfa
28
gravity.sh
28
gravity.sh
@ -50,9 +50,6 @@ if [[ -f $piholeIPv6file ]];then
|
|||||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Variables for various stages of downloading and formatting the list
|
# Variables for various stages of downloading and formatting the list
|
||||||
## Nate 3/26/2016 - Commented unused variables
|
## Nate 3/26/2016 - Commented unused variables
|
||||||
basename=pihole
|
basename=pihole
|
||||||
@ -74,9 +71,7 @@ if [[ -r $piholeDir/pihole.conf ]];then
|
|||||||
. $piholeDir/pihole.conf
|
. $piholeDir/pihole.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
spinner() {
|
||||||
spinner()
|
|
||||||
{
|
|
||||||
local pid=$1
|
local pid=$1
|
||||||
local delay=0.50
|
local delay=0.50
|
||||||
local spinstr='|/-\'
|
local spinstr='|/-\'
|
||||||
@ -225,10 +220,8 @@ function gravity_Schwarzchild() {
|
|||||||
cat "$i" | tr -d '\r' >> $piholeDir/$matterandlight
|
cat "$i" | tr -d '\r' >> $piholeDir/$matterandlight
|
||||||
done
|
done
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function gravity_Blacklist(){
|
function gravity_Blacklist(){
|
||||||
# Append blacklist entries if they exist
|
# Append blacklist entries if they exist
|
||||||
echo -n "::: Running blacklist script to update HOSTS file...."
|
echo -n "::: Running blacklist script to update HOSTS file...."
|
||||||
@ -237,11 +230,8 @@ function gravity_Blacklist(){
|
|||||||
numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt")
|
numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt")
|
||||||
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
||||||
echo " $numBlacklisted domain${plural} blacklisted!"
|
echo " $numBlacklisted domain${plural} blacklisted!"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function gravity_Whitelist() {
|
function gravity_Whitelist() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
# Prevent our sources from being pulled into the hole
|
# Prevent our sources from being pulled into the hole
|
||||||
@ -261,9 +251,6 @@ function gravity_Whitelist() {
|
|||||||
numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt")
|
numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt")
|
||||||
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
||||||
echo " $numWhitelisted domain${plural} whitelisted!"
|
echo " $numWhitelisted domain${plural} whitelisted!"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gravity_unique() {
|
function gravity_unique() {
|
||||||
@ -278,17 +265,19 @@ function gravity_unique() {
|
|||||||
function gravity_hostFormat() {
|
function gravity_hostFormat() {
|
||||||
# Format domain list as "192.168.x.x domain.com"
|
# Format domain list as "192.168.x.x domain.com"
|
||||||
echo "::: Formatting domains into a HOSTS file..."
|
echo "::: Formatting domains into a HOSTS file..."
|
||||||
|
hostname=$(</etc/hostname)
|
||||||
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
|
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
|
||||||
if [[ -n $piholeIPv6 ]];then
|
if [[ -n $piholeIPv6 ]];then
|
||||||
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
|
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||||
echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
|
echo -e "$piholeIP $hostname\n$piholeIPv6 $hostname\n$piholeIP pi.hole\n$piholeIPv6 pi.hole" > $piholeDir/$accretionDisc
|
||||||
cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc
|
cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc
|
||||||
else
|
else
|
||||||
# Otherwise, just create gravity.list as normal using IPv4
|
# Otherwise, just create gravity.list as normal using IPv4
|
||||||
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
|
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||||
echo -e "$piholeIP Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
|
echo -e "$piholeIP $hostname\n$piholeIP pi.hole" > $piholeDir/$accretionDisc
|
||||||
cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> $piholeDir/$accretionDisc
|
cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> $piholeDir/$accretionDisc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||||
cp $piholeDir/$accretionDisc $adList
|
cp $piholeDir/$accretionDisc $adList
|
||||||
}
|
}
|
||||||
@ -308,8 +297,6 @@ function gravity_blackbody() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gravity_advanced() {
|
function gravity_advanced() {
|
||||||
|
|
||||||
|
|
||||||
# Remove comments and print only the domain name
|
# Remove comments and print only the domain name
|
||||||
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious
|
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious
|
||||||
# This helps with that and makes it easier to read
|
# This helps with that and makes it easier to read
|
||||||
@ -322,7 +309,6 @@ function gravity_advanced() {
|
|||||||
echo "::: $numberOf domains being pulled in by gravity..."
|
echo "::: $numberOf domains being pulled in by gravity..."
|
||||||
|
|
||||||
gravity_unique
|
gravity_unique
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gravity_reload() {
|
function gravity_reload() {
|
||||||
|
Loading…
Reference in New Issue
Block a user