|
|
|
@ -38,14 +38,14 @@ lighttpdConfig=/etc/lighttpd/lighttpd.conf
|
|
|
|
|
# This is a file used for the colorized output
|
|
|
|
|
coltable=/opt/pihole/COL_TABLE
|
|
|
|
|
|
|
|
|
|
# We store several other folders and
|
|
|
|
|
# We store several other directories and
|
|
|
|
|
webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git"
|
|
|
|
|
webInterfaceDir="/var/www/html/admin"
|
|
|
|
|
piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
|
|
|
|
|
PI_HOLE_LOCAL_REPO="/etc/.pihole"
|
|
|
|
|
# These are the names of pi-holes files, stored in an array
|
|
|
|
|
PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update version gravity uninstall webpage)
|
|
|
|
|
# This folder is where the Pi-hole scripts will be installed
|
|
|
|
|
# This directory is where the Pi-hole scripts will be installed
|
|
|
|
|
PI_HOLE_INSTALL_DIR="/opt/pihole"
|
|
|
|
|
PI_HOLE_CONFIG_DIR="/etc/pihole"
|
|
|
|
|
useUpdateVars=false
|
|
|
|
@ -320,7 +320,7 @@ else
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# A function for checking if a folder is a git repository
|
|
|
|
|
# A function for checking if a directory is a git repository
|
|
|
|
|
is_repo() {
|
|
|
|
|
# Use a named, local variable instead of the vague $1, which is the first argument passed to this function
|
|
|
|
|
# These local variables should always be lowercase
|
|
|
|
@ -335,7 +335,7 @@ is_repo() {
|
|
|
|
|
if [[ -d "${directory}" ]]; then
|
|
|
|
|
# move into the directory
|
|
|
|
|
cd "${directory}"
|
|
|
|
|
# Use git to check if the folder is a repo
|
|
|
|
|
# Use git to check if the directory is a repo
|
|
|
|
|
# git -C is not used here to support git versions older than 1.8.4
|
|
|
|
|
git status --short &> /dev/null || rc=$?
|
|
|
|
|
# If the command was not successful,
|
|
|
|
@ -1087,19 +1087,42 @@ chooseBlocklists() {
|
|
|
|
|
# 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
|
|
|
|
|
appendToListsFile choice
|
|
|
|
|
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}";;
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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 useful to use userdefined blocklist.
|
|
|
|
|
# If this file exists, we avoid overriding 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
|
|
|
|
|
version_check_dnsmasq() {
|
|
|
|
|
# Local, named variables
|
|
|
|
@ -2099,7 +2122,7 @@ FTLinstall() {
|
|
|
|
|
# the download failed, so just go back to the original directory
|
|
|
|
|
popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; }
|
|
|
|
|
echo -e "${OVER} ${CROSS} ${str}"
|
|
|
|
|
echo -e " ${COL_LIGHT_RED}Error: Download of binary from Github failed${COL_NC}"
|
|
|
|
|
echo -e " ${COL_LIGHT_RED}Error: Download of ${url}/${binary} failed (checksum error)${COL_NC}"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
# Otherwise,
|
|
|
|
@ -2107,7 +2130,7 @@ FTLinstall() {
|
|
|
|
|
popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; }
|
|
|
|
|
echo -e "${OVER} ${CROSS} ${str}"
|
|
|
|
|
# The URL could not be found
|
|
|
|
|
echo -e " ${COL_LIGHT_RED}Error: URL not found${COL_NC}"
|
|
|
|
|
echo -e " ${COL_LIGHT_RED}Error: URL ${url}/${binary} not found${COL_NC}"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
@ -2151,11 +2174,6 @@ get_binary_name() {
|
|
|
|
|
# set the binary to be used
|
|
|
|
|
binary="pihole-FTL-arm-linux-gnueabi"
|
|
|
|
|
fi
|
|
|
|
|
elif [[ "${machine}" == "ppc" ]]; then
|
|
|
|
|
# PowerPC
|
|
|
|
|
echo -e "${OVER} ${TICK} Detected PowerPC architecture"
|
|
|
|
|
# set the binary to be used
|
|
|
|
|
binary="pihole-FTL-powerpc-linux-gnu"
|
|
|
|
|
elif [[ "${machine}" == "x86_64" ]]; then
|
|
|
|
|
# This gives the architecture of packages dpkg installs (for example, "i386")
|
|
|
|
|
local dpkgarch
|
|
|
|
@ -2347,6 +2365,8 @@ main() {
|
|
|
|
|
echo -e " ${INFO} Performing unattended setup, no whiptail dialogs will be displayed"
|
|
|
|
|
# Use the setup variables
|
|
|
|
|
useUpdateVars=true
|
|
|
|
|
# also disable debconf-apt-progress dialogs
|
|
|
|
|
export DEBIAN_FRONTEND="noninteractive"
|
|
|
|
|
# Otherwise,
|
|
|
|
|
else
|
|
|
|
|
# show the available options (repair/reconfigure)
|
|
|
|
@ -2394,6 +2414,8 @@ main() {
|
|
|
|
|
# Let the user decide if they want query logging enabled...
|
|
|
|
|
setLogging
|
|
|
|
|
else
|
|
|
|
|
# Setup adlist file if not exists
|
|
|
|
|
installDefaultBlocklists
|
|
|
|
|
# Source ${setupVars} to use predefined user variables in the functions
|
|
|
|
|
source ${setupVars}
|
|
|
|
|
fi
|
|
|
|
@ -2461,9 +2483,12 @@ main() {
|
|
|
|
|
echo -e " ${INFO} Restarting services..."
|
|
|
|
|
# Start services
|
|
|
|
|
|
|
|
|
|
# Enable FTL
|
|
|
|
|
start_service pihole-FTL
|
|
|
|
|
# Enable FTL
|
|
|
|
|
# Ensure the service is enabled before trying to start it
|
|
|
|
|
# Fixes a problem reported on Ubuntu 18.04 where trying to start
|
|
|
|
|
# the service before enabling causes installer to exit
|
|
|
|
|
enable_service pihole-FTL
|
|
|
|
|
start_service pihole-FTL
|
|
|
|
|
|
|
|
|
|
# Download and compile the aggregated block list
|
|
|
|
|
runGravity
|
|
|
|
|