mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-15 20:09:05 +00:00
remove trailing whitespace gravity.sh
This commit is contained in:
parent
613ab9febc
commit
e4ddf8bc33
1 changed files with 21 additions and 21 deletions
42
gravity.sh
42
gravity.sh
|
@ -107,7 +107,7 @@ function gravity_collapse() {
|
||||||
sources+=($line)
|
sources+=($line)
|
||||||
fi
|
fi
|
||||||
done < $adListFile
|
done < $adListFile
|
||||||
echo " done!"
|
echo " done!"
|
||||||
else
|
else
|
||||||
#no custom file found, use defaults!
|
#no custom file found, use defaults!
|
||||||
echo -n "::: No custom adlist file detected, reading from default file..."
|
echo -n "::: No custom adlist file detected, reading from default file..."
|
||||||
|
@ -120,8 +120,8 @@ function gravity_collapse() {
|
||||||
sources+=($line)
|
sources+=($line)
|
||||||
fi
|
fi
|
||||||
done < $adListDefault
|
done < $adListDefault
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the pihole resource directory if it doesn't exist. Future files will be stored here
|
# Create the pihole resource directory if it doesn't exist. Future files will be stored here
|
||||||
if [[ -d $piholeDir ]];then
|
if [[ -d $piholeDir ]];then
|
||||||
|
@ -169,9 +169,9 @@ function gravity_transport() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Silently curl url
|
# Silently curl url
|
||||||
curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer
|
curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer
|
||||||
# Check for list updates
|
# Check for list updates
|
||||||
gravity_patternCheck $patternBuffer
|
gravity_patternCheck $patternBuffer
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f $patternBuffer
|
rm -f $patternBuffer
|
||||||
|
@ -219,13 +219,13 @@ function gravity_Schwarzchild() {
|
||||||
echo "::: "
|
echo "::: "
|
||||||
# Find all active domains and compile them into one file and remove CRs
|
# Find all active domains and compile them into one file and remove CRs
|
||||||
echo -n "::: Aggregating list of domains..."
|
echo -n "::: Aggregating list of domains..."
|
||||||
truncate -s 0 $piholeDir/$matterandlight & spinner $!
|
truncate -s 0 $piholeDir/$matterandlight & spinner $!
|
||||||
for i in "${activeDomains[@]}"
|
for i in "${activeDomains[@]}"
|
||||||
do
|
do
|
||||||
cat $i |tr -d '\r' >> $piholeDir/$matterandlight
|
cat $i |tr -d '\r' >> $piholeDir/$matterandlight
|
||||||
done
|
done
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,12 +233,12 @@ 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...."
|
||||||
$blacklistScript -f -nr -q > /dev/null & spinner $!
|
$blacklistScript -f -nr -q > /dev/null & spinner $!
|
||||||
|
|
||||||
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!"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ function gravity_Whitelist() {
|
||||||
# Prevent our sources from being pulled into the hole
|
# Prevent our sources from being pulled into the hole
|
||||||
plural=; [[ "${sources[@]}" != "1" ]] && plural=s
|
plural=; [[ "${sources[@]}" != "1" ]] && plural=s
|
||||||
echo -n "::: Adding ${#sources[@]} ad list source${plural} to the whitelist..."
|
echo -n "::: Adding ${#sources[@]} ad list source${plural} to the whitelist..."
|
||||||
|
|
||||||
urls=()
|
urls=()
|
||||||
for url in ${sources[@]}
|
for url in ${sources[@]}
|
||||||
do
|
do
|
||||||
|
@ -255,16 +255,16 @@ function gravity_Whitelist() {
|
||||||
urls=("${urls[@]}" $tmp)
|
urls=("${urls[@]}" $tmp)
|
||||||
done
|
done
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
echo -n "::: Running whitelist script to update HOSTS file...."
|
echo -n "::: Running whitelist script to update HOSTS file...."
|
||||||
$whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $!
|
$whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $!
|
||||||
|
|
||||||
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() {
|
||||||
|
@ -284,7 +284,7 @@ function gravity_hostFormat() {
|
||||||
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
|
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
|
||||||
echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
|
echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $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 dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
|
||||||
|
@ -319,12 +319,12 @@ function gravity_advanced() {
|
||||||
echo -n "::: Formatting list of domains to remove comments...."
|
echo -n "::: Formatting list of domains to remove comments...."
|
||||||
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$matterandlight | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $piholeDir/$supernova & spinner $!
|
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$matterandlight | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $piholeDir/$supernova & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
numberOf=$(wc -l < $piholeDir/$supernova)
|
numberOf=$(wc -l < $piholeDir/$supernova)
|
||||||
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() {
|
||||||
|
@ -333,7 +333,7 @@ function gravity_reload() {
|
||||||
echo -n "::: Cleaning up un-needed files..."
|
echo -n "::: Cleaning up un-needed files..."
|
||||||
$SUDO rm /etc/pihole/pihole.*
|
$SUDO rm /etc/pihole/pihole.*
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
# Reload hosts file
|
# Reload hosts file
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: Refresh lists in dnsmasq..."
|
echo -n "::: Refresh lists in dnsmasq..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue