- Add new whipstail to choose from example blocklists on new install

- remove adlists.default
- do not copy non-existent adlists.default on run of gravity

Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
Adam Warner 2018-04-17 09:50:25 +01:00
parent 557372b312
commit 88d4108f92
No known key found for this signature in database
GPG key ID: F5410858022DA5EB
3 changed files with 39 additions and 28 deletions

View file

@ -1,23 +0,0 @@
# The below list amalgamates several lists we used previously.
# See `https://github.com/StevenBlack/hosts` for details
##StevenBlack's list
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
##MalwareDomains
https://mirror1.malwaredomains.com/files/justdomains
##Cameleon
http://sysctl.org/cameleon/hosts
##Zeustracker
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
##Disconnect.me Tracking
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
##Disconnect.me Ads
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
##Hosts-file.net
https://hosts-file.net/ad_servers.txt

View file

@ -49,6 +49,7 @@ PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update versi
PI_HOLE_INSTALL_DIR="/opt/pihole" PI_HOLE_INSTALL_DIR="/opt/pihole"
useUpdateVars=false useUpdateVars=false
adlistFile="/etc/pihole/adlists.list"
# Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until # Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until
# this script can run # this script can run
IPV4_ADDRESS="" IPV4_ADDRESS=""
@ -955,6 +956,39 @@ setAdminFlag() {
esac esac
} }
# A function to display a list of example blocklists for users to select
chooseBlocklists() {
# Let user select (or not) blocklists via a checklist
cmd=(whiptail --separate-output --checklist "In order to block ads Pi-Hole relies on blacklists, either sourced from third party curated lists, or through building up a custom blacklist.\\n\\nBelow you will find some examples of third party lists.\\n\\nPlease note, the installation can be completed without any of these lists selected, but nothing will be blocked until you add your own." "${r}" "${c}" 7)
# In an array, show the options available (all off by default):
options=(StevenBlack "StevenBlack's Unified Hosts List" off
MalwareDom "MalwareDomains" off
Cameleon "Cameleon" off
ZeusTracker "ZeusTracker" off
DisconTrack "Disconnect.me Tracking" off
DisconAd "Disconnect.me Ads" off
HostsFile "Hosts-file.net Ads" off)
# In a variable, show the choices available; exit if Cancel is selected
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || { echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}"; exit 1; }
# For each choice available,
for choice in ${choices}
do
# Set the values to true
case ${choice} in
StevenBlack ) echo "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> "${adlistFile}";;
MalwareDom ) echo "https://mirror1.malwaredomains.com/files/justdomains" >> "${adlistFile}";;
Cameleon ) echo "http://sysctl.org/cameleon/hosts" >> "${adlistFile}";;
ZeusTracker ) echo "https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist" >> "${adlistFile}";;
DisconTrack ) echo "https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.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}";;
esac
done
}
# 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
version_check_dnsmasq() { version_check_dnsmasq() {
# Local, named variables # Local, named variables
@ -2100,6 +2134,10 @@ main() {
chooseInterface chooseInterface
# Decide what upstream DNS Servers to use # Decide what upstream DNS Servers to use
setDNS setDNS
# If adlists.list file does not exist, give the user the choice of adding some example lists
if [[ ! -f "${adlistFile}" ]]; then
chooseBlocklists
fi
# Let the user decide if they want to block ads over IPv4 and/or IPv6 # Let the user decide if they want to block ads over IPv4 and/or IPv6
use4andor6 use4andor6
# Let the user decide if they want the web interface to be installed automatically # Let the user decide if they want the web interface to be installed automatically

View file

@ -20,11 +20,9 @@ basename="pihole"
PIHOLE_COMMAND="/usr/local/bin/${basename}" PIHOLE_COMMAND="/usr/local/bin/${basename}"
piholeDir="/etc/${basename}" piholeDir="/etc/${basename}"
piholeRepo="/etc/.${basename}"
adListFile="${piholeDir}/adlists.list" adListFile="${piholeDir}/adlists.list"
adListDefault="${piholeDir}/adlists.default" adListDefault="${piholeDir}/adlists.default"
adListRepoDefault="${piholeRepo}/adlists.default"
whitelistFile="${piholeDir}/whitelist.txt" whitelistFile="${piholeDir}/whitelist.txt"
blacklistFile="${piholeDir}/blacklist.txt" blacklistFile="${piholeDir}/blacklist.txt"
@ -133,9 +131,7 @@ gravity_GetBlocklistUrls() {
# Determine if adlists file needs handling # Determine if adlists file needs handling
if [[ ! -f "${adListFile}" ]]; then if [[ ! -f "${adListFile}" ]]; then
# Create "adlists.list" by copying "adlists.default" from internal core repo echo -e " ${CROSS} No adlists file found. Nothing to do!"
cp "${adListRepoDefault}" "${adListFile}" 2> /dev/null || \
echo -e " ${CROSS} Unable to copy ${adListFile##*/} from ${piholeRepo}"
elif [[ -f "${adListDefault}" ]] && [[ -f "${adListFile}" ]]; then elif [[ -f "${adListDefault}" ]] && [[ -f "${adListFile}" ]]; then
# Remove superceded $adListDefault file # Remove superceded $adListDefault file
rm "${adListDefault}" 2> /dev/null || \ rm "${adListDefault}" 2> /dev/null || \