mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-26 21:18:18 +00:00
replace blacklist with blacklistFile
This commit is contained in:
parent
ab24e61754
commit
a79da9a0ff
1 changed files with 6 additions and 6 deletions
|
@ -50,8 +50,8 @@ HandleOther(){
|
|||
|
||||
PopBlacklistFile(){
|
||||
#check blacklist file exists, and if not, create it
|
||||
if [[ ! -f ${blacklist} ]];then
|
||||
touch ${blacklist}
|
||||
if [[ ! -f ${blacklistFile} ]];then
|
||||
touch ${blacklistFile}
|
||||
fi
|
||||
for dom in "${domList[@]}"; do
|
||||
if "$addmode"; then
|
||||
|
@ -65,13 +65,13 @@ PopBlacklistFile(){
|
|||
AddDomain(){
|
||||
#| sed 's/\./\\./g'
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
||||
grep -Ex -q "$1" ${blacklistFile} || bool=true
|
||||
if ${bool}; then
|
||||
#domain not found in the blacklist file, add it!
|
||||
if ${verbose}; then
|
||||
echo -n "::: Adding $1 to blacklist file..."
|
||||
fi
|
||||
echo "$1" >> ${blacklist}
|
||||
echo "$1" >> ${blacklistFile}
|
||||
echo " done!"
|
||||
else
|
||||
if ${verbose}; then
|
||||
|
@ -83,7 +83,7 @@ AddDomain(){
|
|||
RemoveDomain(){
|
||||
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
||||
grep -Ex -q "$1" ${blacklistFile} || bool=true
|
||||
if ${bool}; then
|
||||
#Domain is not in the blacklist file, no need to Remove
|
||||
if ${verbose}; then
|
||||
|
@ -94,7 +94,7 @@ RemoveDomain(){
|
|||
if ${verbose}; then
|
||||
echo "::: Un-blacklisting $dom..."
|
||||
fi
|
||||
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${blacklist}
|
||||
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${blacklistFile}
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue