Improve displayed messages and overall logic

pull/1534/head
DL6ER 7 years ago
parent 92e691408f
commit 8bad56e897
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD

@ -236,9 +236,7 @@ gravity_Blacklist() {
if [[ -f "${blacklistFile}" ]]; then if [[ -f "${blacklistFile}" ]]; then
numBlacklisted=$(wc -l < "${blacklistFile}") numBlacklisted=$(wc -l < "${blacklistFile}")
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
echo -n "::: Blacklisting $numBlacklisted domain${plural}..." echo "::: Exact blocked domain${plural}: $numBlacklisted"
cat "${blacklistFile}" > "${blackList}.tmp"
echo " done!"
else else
echo "::: Nothing to blacklist!" echo "::: Nothing to blacklist!"
fi fi
@ -345,12 +343,16 @@ gravity_hostFormatGravity() {
} }
gravity_hostFormatBlack() { gravity_hostFormatBlack() {
# Format domain list as "192.168.x.x domain.com" if [[ -f "${blacklistFile}" ]]; then
echo -e "" > "${blackList}.tmp" numBlacklisted=$(wc -l < "${blacklistFile}")
gravity_doHostFormat "${blackList}.tmp" "${blackList}" # Format domain list as "192.168.x.x domain.com"
# Copy the file over as /etc/pihole/black.list so dnsmasq can use it gravity_doHostFormat "${blacklistFile}" "${blackList}.tmp"
cp "${blackList}.tmp" "${blackList}" # Copy the file over as /etc/pihole/black.list so dnsmasq can use it
rm "${blackList}.tmp" cp "${blackList}.tmp" "${blackList}"
rm "${blackList}.tmp"
else
echo "::: Nothing to blacklist!"
fi
} }
# blackbody - remove any remnant files from script processes # blackbody - remove any remnant files from script processes

Loading…
Cancel
Save