change whitelist to whitelistFile

This commit is contained in:
tuplink 2016-10-20 13:45:00 -04:00
parent c3f2a9328f
commit ab24e61754

View file

@ -50,8 +50,8 @@ HandleOther(){
PopWhitelistFile(){
#check whitelist file exists, and if not, create it
if [[ ! -f ${whitelist} ]];then
touch ${whitelist}
if [[ ! -f ${whitelistFile} ]];then
touch ${whitelistFile}
fi
for dom in "${domList[@]}"
do
@ -67,13 +67,13 @@ AddDomain(){
#| sed 's/\./\\./g'
bool=false
grep -Ex -q "$1" ${whitelist} || bool=true
grep -Ex -q "$1" ${whitelistFile} || bool=true
if ${bool}; then
#domain not found in the whitelist file, add it!
if ${verbose}; then
echo -n "::: Adding $1 to $whitelist..."
fi
echo "$1" >> ${whitelist}
echo "$1" >> ${whitelistFile}
if ${verbose}; then
echo " done!"
fi
@ -87,14 +87,14 @@ AddDomain(){
RemoveDomain(){
bool=false
grep -Ex -q "$1" ${whitelist} || bool=true
grep -Ex -q "$1" ${whitelistFile} || bool=true
if ${bool}; then
#Domain is not in the whitelist file, no need to Remove
if ${verbose}; then
echo "::: $1 is NOT whitelisted! No need to remove"
fi
else
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelist}
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelistFile}
#reload gravity to pickup any entries this may have removed
pihole -g
fi
@ -113,7 +113,7 @@ DisplayWlist() {
do
echo "${count}: $RD"
count=$((count+1))
done < "$whitelist"
done < "$whitelistFile"
}
###################################################