mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-26 21:18:18 +00:00
add a bunch of quotes
This commit is contained in:
parent
7ae700c635
commit
a12f808516
4 changed files with 31 additions and 33 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 ${blacklistFile} ]];then
|
if [[ ! -f "${blacklistFile"} ]];then
|
||||||
touch ${blacklistFile}
|
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" ${blacklistFile} || 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" >> ${blacklistFile}
|
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" ${blacklistFile} || 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 /'{}'(?!.)/;' ${blacklistFile}
|
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' "${blacklistFile}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ HandleOther(){
|
||||||
|
|
||||||
PopWhitelistFile(){
|
PopWhitelistFile(){
|
||||||
#check whitelist file exists, and if not, create it
|
#check whitelist file exists, and if not, create it
|
||||||
if [[ ! -f ${whitelistFile} ]];then
|
if [[ ! -f "${whitelistFile}" ]];then
|
||||||
touch ${whitelistFile}
|
touch "${whitelistFile}"
|
||||||
fi
|
fi
|
||||||
for dom in "${domList[@]}"
|
for dom in "${domList[@]}"
|
||||||
do
|
do
|
||||||
|
@ -67,13 +67,13 @@ AddDomain(){
|
||||||
#| sed 's/\./\\./g'
|
#| sed 's/\./\\./g'
|
||||||
bool=false
|
bool=false
|
||||||
|
|
||||||
grep -Ex -q "$1" ${whitelistFile} || bool=true
|
grep -Ex -q "$1" "${whitelistFile}" || bool=true
|
||||||
if ${bool}; then
|
if ${bool}; then
|
||||||
#domain not found in the whitelist file, add it!
|
#domain not found in the whitelist file, add it!
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
echo -n "::: Adding $1 to $whitelist..."
|
echo -n "::: Adding $1 to $whitelist..."
|
||||||
fi
|
fi
|
||||||
echo "$1" >> ${whitelistFile}
|
echo "$1" >> "${whitelistFile}"
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
|
@ -87,14 +87,14 @@ AddDomain(){
|
||||||
RemoveDomain(){
|
RemoveDomain(){
|
||||||
|
|
||||||
bool=false
|
bool=false
|
||||||
grep -Ex -q "$1" ${whitelistFile} || bool=true
|
grep -Ex -q "$1" "${whitelistFile}" || bool=true
|
||||||
if ${bool}; then
|
if ${bool}; then
|
||||||
#Domain is not in the whitelist file, no need to Remove
|
#Domain is not in the whitelist file, no need to Remove
|
||||||
if ${verbose}; then
|
if ${verbose}; then
|
||||||
echo "::: $1 is NOT whitelisted! No need to remove"
|
echo "::: $1 is NOT whitelisted! No need to remove"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${whitelistFile}
|
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' "${whitelistFile}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
gravity.sh
22
gravity.sh
|
@ -26,7 +26,7 @@ helpFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ -f ${setupVars} ]];then
|
if [[ -f "${setupVars}" ]];then
|
||||||
. /etc/pihole/setupVars.conf
|
. /etc/pihole/setupVars.conf
|
||||||
else
|
else
|
||||||
echo "::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure."
|
echo "::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure."
|
||||||
|
@ -38,20 +38,18 @@ fi
|
||||||
IPv4_address=${IPv4_address%/*}
|
IPv4_address=${IPv4_address%/*}
|
||||||
|
|
||||||
# Variables for various stages of downloading and formatting the list
|
# Variables for various stages of downloading and formatting the list
|
||||||
basename=pihole
|
adList="${piholeDir}/gravity.list"
|
||||||
piholeDir=/etc/${basename}
|
justDomainsExtension="domains"
|
||||||
adList=${piholeDir}/gravity.list
|
matterAndLight="${basename}.0.matterandlight.txt"
|
||||||
justDomainsExtension=domains
|
supernova="${basename}.1.supernova.txt"
|
||||||
matterAndLight=${basename}.0.matterandlight.txt
|
preEventHorizon="list.preEventHorizon"
|
||||||
supernova=${basename}.1.supernova.txt
|
eventHorizon="${basename}.2.supernova.txt"
|
||||||
preEventHorizon=list.preEventHorizon
|
accretionDisc="${basename}.3.accretionDisc.txt"
|
||||||
eventHorizon=${basename}.2.supernova.txt
|
|
||||||
accretionDisc=${basename}.3.accretionDisc.txt
|
|
||||||
|
|
||||||
skipDownload=false
|
skipDownload=false
|
||||||
|
|
||||||
# Warn users still using pihole.conf that it no longer has any effect (I imagine about 2 people use it)
|
# Warn users still using pihole.conf that it no longer has any effect (I imagine about 2 people use it)
|
||||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
if [[ -r "${piholeDir}/pihole.conf" ]];then
|
||||||
echo "::: pihole.conf file no longer supported. Over-rides in this file are ignored."
|
echo "::: pihole.conf file no longer supported. Over-rides in this file are ignored."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -115,7 +113,7 @@ gravity_transport() {
|
||||||
# tmp file, so we don't have to store the (long!) lists in RAM
|
# tmp file, so we don't have to store the (long!) lists in RAM
|
||||||
patternBuffer=$(mktemp)
|
patternBuffer=$(mktemp)
|
||||||
heisenbergCompensator=""
|
heisenbergCompensator=""
|
||||||
if [[ -r ${saveLocation} ]]; then
|
if [[ -r "${saveLocation"} ]]; then
|
||||||
# if domain has been saved, add file for date check to only download newer
|
# if domain has been saved, add file for date check to only download newer
|
||||||
heisenbergCompensator="-z $saveLocation"
|
heisenbergCompensator="-z $saveLocation"
|
||||||
fi
|
fi
|
||||||
|
|
18
pihole
18
pihole
|
@ -125,15 +125,15 @@ fi
|
||||||
#Source the setupVars from install script for the IP
|
#Source the setupVars from install script for the IP
|
||||||
export setupVars=/etc/pihole/setupVars.conf
|
export setupVars=/etc/pihole/setupVars.conf
|
||||||
|
|
||||||
export basename=pihole
|
export basename="pihole"
|
||||||
export piholeDir=/etc/${basename}
|
export piholeDir="/etc/${basename}"
|
||||||
export adList=${piholeDir}/gravity.list
|
export adList="${piholeDir}/gravity.list"
|
||||||
export blacklistFile=${piholeDir}/blacklist.txt
|
export blacklistFile="${piholeDir}/blacklist.txt"
|
||||||
export whitelistFile=${piholeDir}/whitelist.txt
|
export whitelistFile="${piholeDir}/whitelist.txt"
|
||||||
export adListFile=${piholeDir}/adlists.list
|
export adListFile="${piholeDir}/adlists.list"
|
||||||
export adListDefault=${piholeDir}/adlists.default
|
export adListDefault="${piholeDir}/adlists.default"
|
||||||
export whitelistScript=/opt/pihole/whitelist.sh
|
export whitelistScript="/opt/pihole/whitelist.sh"
|
||||||
export blacklistScript=/opt/pihole/blacklist.sh
|
export blacklistScript="/opt/pihole/blacklist.sh"
|
||||||
|
|
||||||
|
|
||||||
# Handle redirecting to specific functions based on arguments
|
# Handle redirecting to specific functions based on arguments
|
||||||
|
|
Loading…
Add table
Reference in a new issue