mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-25 08:40:12 +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(){
|
PopBlacklistFile(){
|
||||||
#check blacklist file exists, and if not, create it
|
#check blacklist file exists, and if not, create it
|
||||||
if [[ ! -f ${blacklist} ]];then
|
if [[ ! -f ${blacklistFile} ]];then
|
||||||
touch ${blacklist}
|
touch ${blacklistFile}
|
||||||
fi
|
fi
|
||||||
for dom in "${domList[@]}"; do
|
for dom in "${domList[@]}"; do
|
||||||
if "$addmode"; then
|
if "$addmode"; then
|
||||||
|
@ -65,13 +65,13 @@ PopBlacklistFile(){
|
||||||
AddDomain(){
|
AddDomain(){
|
||||||
#| sed 's/\./\\./g'
|
#| sed 's/\./\\./g'
|
||||||
bool=false
|
bool=false
|
||||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
grep -Ex -q "$1" ${blacklistFile} || bool=true
|
||||||
if ${bool}; then
|
if ${bool}; then
|
||||||
#domain not found in the blacklist file, add it!
|
#domain not found in the blacklist file, add it!
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
echo -n "::: Adding $1 to blacklist file..."
|
echo -n "::: Adding $1 to blacklist file..."
|
||||||
fi
|
fi
|
||||||
echo "$1" >> ${blacklist}
|
echo "$1" >> ${blacklistFile}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
else
|
else
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
|
@ -83,7 +83,7 @@ AddDomain(){
|
||||||
RemoveDomain(){
|
RemoveDomain(){
|
||||||
|
|
||||||
bool=false
|
bool=false
|
||||||
grep -Ex -q "$1" ${blacklist} || bool=true
|
grep -Ex -q "$1" ${blacklistFile} || bool=true
|
||||||
if ${bool}; then
|
if ${bool}; then
|
||||||
#Domain is not in the blacklist file, no need to Remove
|
#Domain is not in the blacklist file, no need to Remove
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
|
@ -94,7 +94,7 @@ RemoveDomain(){
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
echo "::: Un-blacklisting $dom..."
|
echo "::: Un-blacklisting $dom..."
|
||||||
fi
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue