flip reload logic. Do not reload if there are not changes made to blacklist.txt

This commit is contained in:
Promofaux 2016-10-23 22:44:06 +01:00
parent bd0cc134bf
commit 7fb622638b

View file

@ -35,7 +35,7 @@ basename=pihole
piholeDir=/etc/${basename} piholeDir=/etc/${basename}
adList=${piholeDir}/gravity.list adList=${piholeDir}/gravity.list
blacklist=${piholeDir}/blacklist.txt blacklist=${piholeDir}/blacklist.txt
reload=true reload=false
addmode=true addmode=true
verbose=true verbose=true
@ -76,6 +76,7 @@ AddDomain() {
echo -n "::: Adding $1 to blacklist file..." echo -n "::: Adding $1 to blacklist file..."
fi fi
echo "$1" >> ${blacklist} echo "$1" >> ${blacklist}
reload=true
echo " done!" echo " done!"
else else
if ${verbose}; then if ${verbose}; then
@ -99,6 +100,7 @@ RemoveDomain() {
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 /'{}'(?!.)/;' ${blacklist}
reload=true
fi fi
} }