account for new `adlists.custom` file

This commit is contained in:
Adam Warner 2017-03-31 19:00:04 +01:00
parent 86fa4e9ee8
commit ce97896ffd
No known key found for this signature in database
GPG Key ID: 7C062498C7FA6E49
1 changed files with 18 additions and 4 deletions

View File

@ -30,6 +30,7 @@ PIHOLE_COMMAND="/usr/local/bin/pihole"
adListFile=/etc/pihole/adlists.list
adListDefault=/etc/pihole/adlists.default
adListCustom=/etc/pihole/adlists.custom
whitelistScript="${PIHOLE_COMMAND} -w"
whitelistFile=/etc/pihole/whitelist.txt
blacklistFile=/etc/pihole/blacklist.txt
@ -75,8 +76,8 @@ gravity_collapse() {
echo ":::"
#Decide if we're using a custom ad block list, or defaults.
if [ -f ${adListFile} ]; then
#custom file found, use this instead of default
echo -n "::: Custom adList file detected. Reading..."
#User has disabled one or more default lists
echo -n "::: Changes to default list detected. Reading adlists.list..."
sources=()
while IFS= read -r line || [[ -n "$line" ]]; do
#Do not read commented out or blank lines
@ -88,8 +89,8 @@ gravity_collapse() {
done < ${adListFile}
echo " done!"
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=()
while IFS= read -r line || [[ -n "$line" ]]; do
#Do not read commented out or blank lines
@ -101,6 +102,19 @@ gravity_collapse() {
done < ${adListDefault}
echo " done!"
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.