mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-01-12 06:54:53 +00:00
Make output make a bit more sense
This commit is contained in:
parent
8a74942da7
commit
dfcf9d133e
1 changed files with 10 additions and 7 deletions
|
@ -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/')
|
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
|
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
|
else
|
||||||
domList=("${domList[@]}" $validDomain)
|
domList=("${domList[@]}" $validDomain)
|
||||||
fi
|
fi
|
||||||
|
@ -76,17 +76,20 @@ function PopWhitelistFile(){
|
||||||
function AddDomain(){
|
function AddDomain(){
|
||||||
#| sed 's/\./\\./g'
|
#| sed 's/\./\\./g'
|
||||||
bool=false
|
bool=false
|
||||||
|
if $versbose; then
|
||||||
|
echo -n "::: Whitelisting $1...."
|
||||||
|
fi
|
||||||
grep -Ex -q "$1" $whitelist || bool=true
|
grep -Ex -q "$1" $whitelist || bool=true
|
||||||
if $bool; then
|
if $bool; then
|
||||||
#domain not found in the whitelist file, add it!
|
#domain not found in the whitelist file, add it!
|
||||||
if $versbose; then
|
|
||||||
echo "** Adding $1 to whitelist file"
|
|
||||||
fi
|
|
||||||
echo $1 >> $whitelist
|
echo $1 >> $whitelist
|
||||||
modifyHost=true
|
modifyHost=true
|
||||||
|
if $versbose; then
|
||||||
|
echo " done!"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if $versbose; then
|
if $versbose; then
|
||||||
echo "** $1 already whitelisted! No need to add"
|
echo " already whitelisted! No need to add"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -98,7 +101,7 @@ function RemoveDomain(){
|
||||||
if $bool; then
|
if $bool; then
|
||||||
#Domain is not in the whitelist file, no need to Remove
|
#Domain is not in the whitelist file, no need to Remove
|
||||||
if $versbose; then
|
if $versbose; then
|
||||||
echo "** $1 is NOT whitelisted! No need to remove"
|
echo "::: $1 is NOT whitelisted! No need to remove"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#Domain is in the whitelist file, add to a temporary array and remove from whitelist file
|
#Domain is in the whitelist file, add to a temporary array and remove from whitelist file
|
||||||
|
|
Loading…
Reference in a new issue