1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

Make output make a bit more sense

This commit is contained in:
Promofaux 2016-01-24 16:46:00 +00:00
parent 8a74942da7
commit dfcf9d133e

View File

@ -52,7 +52,7 @@ function HandleOther(){
validDomain=$(echo $1 | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
if [ -z "$validDomain" ]; then
echo $1 is not a valid argument or domain name
echo "::: $1 is not a valid argument or domain name"
else
domList=("${domList[@]}" $validDomain)
fi
@ -76,17 +76,20 @@ function PopWhitelistFile(){
function AddDomain(){
#| sed 's/\./\\./g'
bool=false
if $versbose; then
echo -n "::: Whitelisting $1...."
fi
grep -Ex -q "$1" $whitelist || bool=true
if $bool; then
#domain not found in the whitelist file, add it!
if $versbose; then
echo "** Adding $1 to whitelist file"
fi
echo $1 >> $whitelist
modifyHost=true
if $versbose; then
echo " done!"
fi
else
if $versbose; then
echo "** $1 already whitelisted! No need to add"
echo " already whitelisted! No need to add"
fi
fi
}
@ -98,7 +101,7 @@ function RemoveDomain(){
if $bool; then
#Domain is not in the whitelist file, no need to Remove
if $versbose; then
echo "** $1 is NOT whitelisted! No need to remove"
echo "::: $1 is NOT whitelisted! No need to remove"
fi
else
#Domain is in the whitelist file, add to a temporary array and remove from whitelist file