mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
account for new adlists.custom
file
This commit is contained in:
parent
86fa4e9ee8
commit
ce97896ffd
1 changed files with 18 additions and 4 deletions
22
gravity.sh
22
gravity.sh
|
@ -30,6 +30,7 @@ PIHOLE_COMMAND="/usr/local/bin/pihole"
|
||||||
|
|
||||||
adListFile=/etc/pihole/adlists.list
|
adListFile=/etc/pihole/adlists.list
|
||||||
adListDefault=/etc/pihole/adlists.default
|
adListDefault=/etc/pihole/adlists.default
|
||||||
|
adListCustom=/etc/pihole/adlists.custom
|
||||||
whitelistScript="${PIHOLE_COMMAND} -w"
|
whitelistScript="${PIHOLE_COMMAND} -w"
|
||||||
whitelistFile=/etc/pihole/whitelist.txt
|
whitelistFile=/etc/pihole/whitelist.txt
|
||||||
blacklistFile=/etc/pihole/blacklist.txt
|
blacklistFile=/etc/pihole/blacklist.txt
|
||||||
|
@ -75,8 +76,8 @@ gravity_collapse() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
#Decide if we're using a custom ad block list, or defaults.
|
#Decide if we're using a custom ad block list, or defaults.
|
||||||
if [ -f ${adListFile} ]; then
|
if [ -f ${adListFile} ]; then
|
||||||
#custom file found, use this instead of default
|
#User has disabled one or more default lists
|
||||||
echo -n "::: Custom adList file detected. Reading..."
|
echo -n "::: Changes to default list detected. Reading adlists.list..."
|
||||||
sources=()
|
sources=()
|
||||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
#Do not read commented out or blank lines
|
#Do not read commented out or blank lines
|
||||||
|
@ -88,8 +89,8 @@ gravity_collapse() {
|
||||||
done < ${adListFile}
|
done < ${adListFile}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
else
|
else
|
||||||
#no custom file found, use defaults!
|
#
|
||||||
echo -n "::: No custom adlist file detected, reading from default file..."
|
echo -n "::: No changes to default list detected. Reading adlists.default..."
|
||||||
sources=()
|
sources=()
|
||||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
#Do not read commented out or blank lines
|
#Do not read commented out or blank lines
|
||||||
|
@ -101,6 +102,19 @@ gravity_collapse() {
|
||||||
done < ${adListDefault}
|
done < ${adListDefault}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f ${adListCustom} ]; then
|
||||||
|
echo -n "Custom additional lists detected. Reading adlists.custom..."
|
||||||
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
#Do not read commented out or blank lines
|
||||||
|
if [[ ${line} = \#* ]] || [[ ! ${line} ]]; then
|
||||||
|
echo "" > /dev/null
|
||||||
|
else
|
||||||
|
sources+=(${line})
|
||||||
|
fi
|
||||||
|
done < ${adListCustom}
|
||||||
|
echo " done!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# patternCheck - check to see if curl downloaded any new files.
|
# patternCheck - check to see if curl downloaded any new files.
|
||||||
|
|
Loading…
Reference in a new issue