quote setupVars include / remove if statement for piholeIPv6

This commit is contained in:
Tommy Huff 2016-10-19 12:47:39 -04:00
parent 37868a86dd
commit 189d19da37
2 changed files with 35 additions and 57 deletions

View file

@ -26,9 +26,6 @@ helpFunc()
exit 1
}
modifyHost=false
HandleOther(){
#check validity of domain
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
@ -39,13 +36,6 @@ HandleOther(){
fi
}
# After setting defaults, check if there's local overrides
if [[ -r ${piholeDir}/pihole.conf ]];then
echo "::: Local calibration requested..."
. ${piholeDir}/pihole.conf
fi
PopBlacklistFile(){
#check blacklist file exists, and if not, create it
if [[ ! -f ${blacklist} ]];then
@ -163,6 +153,7 @@ DisplayBlist() {
###################################################
#globals
modifyHost=false
reload=true
addmode=true
force=false
@ -194,7 +185,7 @@ if [[ -z "${setupVars}" ]] ; then
setupVars=/etc/pihole/setupVars.conf
fi
if [[ -f "${setupVars}" ]];then
. ${setupVars}
. "${setupVars}"
else
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."

View file

@ -37,14 +37,6 @@ helpFunc()
exit 1
}
modifyHost=false
# After setting defaults, check if there's local overrides
if [[ -r ${piholeDir}/pihole.conf ]];then
echo "::: Local calibration requested..."
. ${piholeDir}/pihole.conf
fi
PopWhitelistFile(){
#check whitelist file exists, and if not, create it
if [[ ! -f ${whitelist} ]];then
@ -125,16 +117,10 @@ ModifyHostFile(){
for rdom in "${domToRemoveList[@]}"; do
if grep -q "$rdom" ${piholeDir}/*.domains; then
echo "::: AdLists contain $rdom, re-adding block"
if [[ -n ${piholeIPv6} ]];then
echo -n "::: Restoring block for $rdom on IPv4 and IPv6..."
echo "$rdom" | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${adList}
echo " done!"
else
echo -n "::: Restoring block for $rdom on IPv4..."
echo "$rdom" | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>${adList}
echo " done!"
fi
fi
echo -n "::: Removing $rdom from $whitelist..."
echo "$rdom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelist}
echo " done!"
@ -180,6 +166,7 @@ DisplayWlist() {
###################################################
#globals
modifyHost=false
reload=true
addmode=true
force=false
@ -210,7 +197,7 @@ if [[ -z "${setupVars}" ]] ; then
setupVars=/etc/pihole/setupVars.conf
fi
if [[ -f "${setupVars}" ]];then
. ${setupVars}
. "${setupVars}"
else
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."