Flip reload logic. Do not reload lists if no changes made to whitelist.txt

This commit is contained in:
Promofaux 2016-10-23 22:36:50 +01:00
parent b79392ba2c
commit 96053d13be
2 changed files with 4 additions and 2 deletions

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

View file

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