mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-27 13:38:16 +00:00
quote setupVars include / remove if statement for piholeIPv6
This commit is contained in:
parent
37868a86dd
commit
189d19da37
2 changed files with 35 additions and 57 deletions
|
@ -26,9 +26,6 @@ helpFunc()
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
modifyHost=false
|
|
||||||
|
|
||||||
|
|
||||||
HandleOther(){
|
HandleOther(){
|
||||||
#check validity of domain
|
#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/')
|
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
|
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(){
|
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 ${blacklist} ]];then
|
||||||
|
@ -163,6 +153,7 @@ DisplayBlist() {
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
#globals
|
#globals
|
||||||
|
modifyHost=false
|
||||||
reload=true
|
reload=true
|
||||||
addmode=true
|
addmode=true
|
||||||
force=false
|
force=false
|
||||||
|
@ -194,7 +185,7 @@ if [[ -z "${setupVars}" ]] ; then
|
||||||
setupVars=/etc/pihole/setupVars.conf
|
setupVars=/etc/pihole/setupVars.conf
|
||||||
fi
|
fi
|
||||||
if [[ -f "${setupVars}" ]];then
|
if [[ -f "${setupVars}" ]];then
|
||||||
. ${setupVars}
|
. "${setupVars}"
|
||||||
else
|
else
|
||||||
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
|
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
|
||||||
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."
|
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."
|
||||||
|
|
|
@ -37,14 +37,6 @@ helpFunc()
|
||||||
exit 1
|
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(){
|
PopWhitelistFile(){
|
||||||
#check whitelist file exists, and if not, create it
|
#check whitelist file exists, and if not, create it
|
||||||
if [[ ! -f ${whitelist} ]];then
|
if [[ ! -f ${whitelist} ]];then
|
||||||
|
@ -125,16 +117,10 @@ ModifyHostFile(){
|
||||||
for rdom in "${domToRemoveList[@]}"; do
|
for rdom in "${domToRemoveList[@]}"; do
|
||||||
if grep -q "$rdom" ${piholeDir}/*.domains; then
|
if grep -q "$rdom" ${piholeDir}/*.domains; then
|
||||||
echo "::: AdLists contain $rdom, re-adding block"
|
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 -n "::: Restoring block for $rdom on IPv4..."
|
||||||
echo "$rdom" | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>${adList}
|
echo "$rdom" | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>${adList}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
echo -n "::: Removing $rdom from $whitelist..."
|
echo -n "::: Removing $rdom from $whitelist..."
|
||||||
echo "$rdom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelist}
|
echo "$rdom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelist}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
@ -180,6 +166,7 @@ DisplayWlist() {
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
#globals
|
#globals
|
||||||
|
modifyHost=false
|
||||||
reload=true
|
reload=true
|
||||||
addmode=true
|
addmode=true
|
||||||
force=false
|
force=false
|
||||||
|
@ -210,7 +197,7 @@ if [[ -z "${setupVars}" ]] ; then
|
||||||
setupVars=/etc/pihole/setupVars.conf
|
setupVars=/etc/pihole/setupVars.conf
|
||||||
fi
|
fi
|
||||||
if [[ -f "${setupVars}" ]];then
|
if [[ -f "${setupVars}" ]];then
|
||||||
. ${setupVars}
|
. "${setupVars}"
|
||||||
else
|
else
|
||||||
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
|
echo "::: WARNING: ${setupVars} missing. Possible installation failure."
|
||||||
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."
|
echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure."
|
||||||
|
|
Loading…
Add table
Reference in a new issue