mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-22 05:51:15 +00:00
Create adlist file while running unattended setup
Signed-off-by: Realtebo <mirkotebaldi@yahoo.it>
This commit is contained in:
parent
afdc4219d0
commit
d9195970b7
@ -1087,8 +1087,15 @@ chooseBlocklists() {
|
|||||||
# For each choice available,
|
# For each choice available,
|
||||||
for choice in ${choices}
|
for choice in ${choices}
|
||||||
do
|
do
|
||||||
# Set the values to true
|
appendToListsFile choice
|
||||||
case ${choice} in
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Accept a string parameter, it must be one of the default lists
|
||||||
|
# This function allow to not duplicate code in chooseBlocklists and
|
||||||
|
# in installDefaultBlocklists
|
||||||
|
appendToListsFile() {
|
||||||
|
case $1 in
|
||||||
StevenBlack ) echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> "${adlistFile}";;
|
StevenBlack ) echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> "${adlistFile}";;
|
||||||
MalwareDom ) echo "https://mirror1.malwaredomains.com/files/justdomains" >> "${adlistFile}";;
|
MalwareDom ) echo "https://mirror1.malwaredomains.com/files/justdomains" >> "${adlistFile}";;
|
||||||
Cameleon ) echo "http://sysctl.org/cameleon/hosts" >> "${adlistFile}";;
|
Cameleon ) echo "http://sysctl.org/cameleon/hosts" >> "${adlistFile}";;
|
||||||
@ -1097,7 +1104,23 @@ chooseBlocklists() {
|
|||||||
DisconAd ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" >> "${adlistFile}";;
|
DisconAd ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" >> "${adlistFile}";;
|
||||||
HostsFile ) echo "https://hosts-file.net/ad_servers.txt" >> "${adlistFile}";;
|
HostsFile ) echo "https://hosts-file.net/ad_servers.txt" >> "${adlistFile}";;
|
||||||
esac
|
esac
|
||||||
done
|
}
|
||||||
|
|
||||||
|
# Used only in unattended setup
|
||||||
|
# If there is already the adListFile, we keep it, else we create it using all default lists
|
||||||
|
installDefaultBlocklists() {
|
||||||
|
# In unattended setup, could be usefull to use userdefined blocklist.
|
||||||
|
# If this file exists, we avoid to override it.
|
||||||
|
if [[ -f "${adlistFile}" ]]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
appendToListsFile StevenBlack
|
||||||
|
appendToListsFile MalwareDom
|
||||||
|
appendToListsFile Cameleon
|
||||||
|
appendToListsFile ZeusTracker
|
||||||
|
appendToListsFile DisconTrack
|
||||||
|
appendToListsFile DisconAd
|
||||||
|
appendToListsFile HostsFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if /etc/dnsmasq.conf is from pi-hole. If so replace with an original and install new in .d directory
|
# Check if /etc/dnsmasq.conf is from pi-hole. If so replace with an original and install new in .d directory
|
||||||
@ -2391,6 +2414,8 @@ main() {
|
|||||||
# Let the user decide if they want query logging enabled...
|
# Let the user decide if they want query logging enabled...
|
||||||
setLogging
|
setLogging
|
||||||
else
|
else
|
||||||
|
# Setup adlist file if not exists
|
||||||
|
installDefaultBlocklists
|
||||||
# Source ${setupVars} to use predefined user variables in the functions
|
# Source ${setupVars} to use predefined user variables in the functions
|
||||||
source ${setupVars}
|
source ${setupVars}
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user