diff --git a/gravity.sh b/gravity.sh index 321aec27..33f5d6d5 100755 --- a/gravity.sh +++ b/gravity.sh @@ -107,7 +107,7 @@ function gravity_collapse() { sources+=($line) fi done < $adListFile - echo " done!" + echo " done!" else #no custom file found, use defaults! echo -n "::: No custom adlist file detected, reading from default file..." @@ -120,8 +120,8 @@ function gravity_collapse() { sources+=($line) fi done < $adListDefault - echo " done!" - fi + echo " done!" + fi # Create the pihole resource directory if it doesn't exist. Future files will be stored here if [[ -d $piholeDir ]];then @@ -169,9 +169,9 @@ function gravity_transport() { fi # 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 - gravity_patternCheck $patternBuffer + gravity_patternCheck $patternBuffer # Cleanup rm -f $patternBuffer @@ -219,13 +219,13 @@ function gravity_Schwarzchild() { echo "::: " # Find all active domains and compile them into one file and remove CRs echo -n "::: Aggregating list of domains..." - truncate -s 0 $piholeDir/$matterandlight & spinner $! + truncate -s 0 $piholeDir/$matterandlight & spinner $! for i in "${activeDomains[@]}" do cat $i |tr -d '\r' >> $piholeDir/$matterandlight done echo " done!" - + } @@ -233,12 +233,12 @@ function gravity_Blacklist(){ # Append blacklist entries if they exist echo -n "::: Running blacklist script to update HOSTS file...." $blacklistScript -f -nr -q > /dev/null & spinner $! - + numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt") plural=; [[ "$numBlacklisted" != "1" ]] && plural=s echo " $numBlacklisted domain${plural} blacklisted!" - - + + } @@ -247,7 +247,7 @@ function gravity_Whitelist() { # Prevent our sources from being pulled into the hole plural=; [[ "${sources[@]}" != "1" ]] && plural=s echo -n "::: Adding ${#sources[@]} ad list source${plural} to the whitelist..." - + urls=() for url in ${sources[@]} do @@ -255,16 +255,16 @@ function gravity_Whitelist() { urls=("${urls[@]}" $tmp) done echo " done!" - + echo -n "::: Running whitelist script to update HOSTS file...." $whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $! - + numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt") plural=; [[ "$numWhitelisted" != "1" ]] && plural=s echo " $numWhitelisted domain${plural} whitelisted!" - - - + + + } 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! 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 - + else # 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! @@ -319,12 +319,12 @@ function gravity_advanced() { 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 $! echo " done!" - + numberOf=$(wc -l < $piholeDir/$supernova) echo "::: $numberOf domains being pulled in by gravity..." - + gravity_unique - + } function gravity_reload() { @@ -333,7 +333,7 @@ function gravity_reload() { echo -n "::: Cleaning up un-needed files..." $SUDO rm /etc/pihole/pihole.* echo " done!" - + # Reload hosts file echo ":::" echo -n "::: Refresh lists in dnsmasq..."