mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 14:18:15 +00:00
Merge branch 'development' into new/UninstallCleanup
This commit is contained in:
commit
c65c26b463
@ -12,10 +12,6 @@
|
|||||||
|
|
||||||
Block ads for **all** your devices _without_ the need to install client-side software.
|
Block ads for **all** your devices _without_ the need to install client-side software.
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href=http://www.digitalocean.com/?refcode=344d234950e1><img src="https://assets.pi-hole.net/static/DOHostingSlug.png"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Executive Summary
|
## Executive Summary
|
||||||
The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
|
The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
|
||||||
|
|
||||||
@ -66,7 +62,7 @@ Alternatively, you can manually set each device to use Pi-hole as their DNS serv
|
|||||||
|
|
||||||
# Pi-hole Is Free, But Powered By Your Donations
|
# Pi-hole Is Free, But Powered By Your Donations
|
||||||
|
|
||||||
[Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) helps with our infrastructure, but [our developers](https://github.com/orgs/pi-hole/people) are all volunteers so *your donations help keep us innovating*.
|
All [our developers](https://github.com/orgs/pi-hole/people) are volunteers, so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
|
||||||
|
|
||||||
- ![Paypal](https://assets.pi-hole.net/static/paypal.png) [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
|
- ![Paypal](https://assets.pi-hole.net/static/paypal.png) [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
|
||||||
- ![Bitcoin](https://assets.pi-hole.net/static/Bitcoin.png) Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
|
- ![Bitcoin](https://assets.pi-hole.net/static/Bitcoin.png) Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
|
||||||
|
@ -261,7 +261,12 @@ ProcessDHCPSettings() {
|
|||||||
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
||||||
leasetime="infinite"
|
leasetime="infinite"
|
||||||
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
|
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
|
||||||
leasetime="24h"
|
leasetime="24"
|
||||||
|
change_setting "DHCP_LEASETIME" "${leasetime}"
|
||||||
|
elif [[ "${DHCP_LEASETIME}" == "24h" ]]; then
|
||||||
|
#Installation is affected by known bug, introduced in a previous version.
|
||||||
|
#This will automatically clean up setupVars.conf and remove the unnecessary "h"
|
||||||
|
leasetime="24"
|
||||||
change_setting "DHCP_LEASETIME" "${leasetime}"
|
change_setting "DHCP_LEASETIME" "${leasetime}"
|
||||||
else
|
else
|
||||||
leasetime="${DHCP_LEASETIME}h"
|
leasetime="${DHCP_LEASETIME}h"
|
||||||
|
@ -21,8 +21,9 @@ if ($serverName === 'pi.hole')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve server URI extension (EG: jpg, exe, php)
|
// Retrieve server URI extension (EG: jpg, exe, php)
|
||||||
|
// strtok($uri, '\?') splits the querystring from the path (if there is a querystring)
|
||||||
ini_set('pcre.recursion_limit',100);
|
ini_set('pcre.recursion_limit',100);
|
||||||
$uriExt = pathinfo($uri, PATHINFO_EXTENSION);
|
$uriExt = pathinfo(strtok($uri,'\?'), PATHINFO_EXTENSION);
|
||||||
|
|
||||||
// Define which URL extensions get rendered as "Website Blocked"
|
// Define which URL extensions get rendered as "Website Blocked"
|
||||||
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
|
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
|
||||||
|
@ -1216,7 +1216,7 @@ install_dependent_packages() {
|
|||||||
if command -v debconf-apt-progress &> /dev/null; then
|
if command -v debconf-apt-progress &> /dev/null; then
|
||||||
# For each package,
|
# For each package,
|
||||||
for i in "${argArray1[@]}"; do
|
for i in "${argArray1[@]}"; do
|
||||||
echo -ne " ${INFO} Checking for $i..."
|
echo -ne " ${INFO} Checking for $i..."
|
||||||
#
|
#
|
||||||
if dpkg-query -W -f='${Status}' "${i}" 2>/dev/null | grep "ok installed" &> /dev/null; then
|
if dpkg-query -W -f='${Status}' "${i}" 2>/dev/null | grep "ok installed" &> /dev/null; then
|
||||||
#
|
#
|
||||||
@ -1243,7 +1243,7 @@ install_dependent_packages() {
|
|||||||
|
|
||||||
# Install Fedora/CentOS packages
|
# Install Fedora/CentOS packages
|
||||||
for i in "${argArray1[@]}"; do
|
for i in "${argArray1[@]}"; do
|
||||||
echo -ne " ${INFO} Checking for $i..."
|
echo -ne " ${INFO} Checking for $i..."
|
||||||
#
|
#
|
||||||
if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then
|
if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then
|
||||||
echo -e "${OVER} ${TICK} Checking for $i"
|
echo -e "${OVER} ${TICK} Checking for $i"
|
||||||
|
69
pihole
69
pihole
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||||
# Network-wide ad blocking via your own hardware.
|
# Network-wide ad blocking via your own hardware.
|
||||||
@ -8,11 +9,11 @@
|
|||||||
# This file is copyright under the latest version of the EUPL.
|
# This file is copyright under the latest version of the EUPL.
|
||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
colfile="/opt/pihole/COL_TABLE"
|
|
||||||
source ${colfile}
|
|
||||||
|
|
||||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||||
|
readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
||||||
|
|
||||||
|
source ${colfile}
|
||||||
|
|
||||||
# Must be root to use this tool
|
# Must be root to use this tool
|
||||||
if [[ ! $EUID -eq 0 ]];then
|
if [[ ! $EUID -eq 0 ]];then
|
||||||
@ -481,41 +482,43 @@ Options:
|
|||||||
echo -e "${OVER} ${TICK} ${str}"
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
}
|
}
|
||||||
|
|
||||||
piholeStatus() {
|
statusFunc() {
|
||||||
if [[ "$(netstat -plnt | grep -c ':53 ')" -gt "0" ]]; then
|
local addnConfigs
|
||||||
|
|
||||||
|
# Determine if service is running on port 53 (Cr: https://superuser.com/a/806331)
|
||||||
|
if (echo > /dev/tcp/localhost/53) >/dev/null 2>&1; then
|
||||||
if [[ "${1}" != "web" ]]; then
|
if [[ "${1}" != "web" ]]; then
|
||||||
echo -e " ${TICK} DNS service is running"
|
echo -e " ${TICK} DNS service is running"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "${1}" == "web" ]]; then
|
case "${1}" in
|
||||||
echo "-1";
|
"web") echo "-1";;
|
||||||
else
|
*) echo -e " ${CROSS} DNS service is NOT running";;
|
||||||
echo -e " ${CROSS} DNS service is NOT running"
|
esac
|
||||||
fi
|
return 0
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$(grep -i "^#addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)" ]]; then
|
# Determine if Pi-hole's addn-hosts configs are commented out
|
||||||
# List is commented out
|
addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)
|
||||||
if [[ "${1}" == "web" ]]; then
|
|
||||||
echo 0;
|
if [[ "${addnConfigs}" =~ "#" ]]; then
|
||||||
else
|
# A config is commented out
|
||||||
echo -e " ${CROSS} Pi-hole blocking is Disabled";
|
case "${1}" in
|
||||||
fi
|
"web") echo 0;;
|
||||||
elif [[ "$(grep -i "^addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)" ]]; then
|
*) echo -e " ${CROSS} Pi-hole blocking is Disabled";;
|
||||||
# List set
|
esac
|
||||||
if [[ "${1}" == "web" ]]; then
|
elif [[ -n "${addnConfigs}" ]]; then
|
||||||
echo 1;
|
# Configs are set
|
||||||
else
|
case "${1}" in
|
||||||
echo -e " ${TICK} Pi-hole blocking is Enabled";
|
"web") echo 1;;
|
||||||
fi
|
*) echo -e " ${TICK} Pi-hole blocking is Enabled";;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
# Addn-host not found
|
# No configs were found
|
||||||
if [[ "${1}" == "web" ]]; then
|
case "${1}" in
|
||||||
echo 99
|
"web") echo 99;;
|
||||||
else
|
*) echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state";;
|
||||||
echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state"
|
esac
|
||||||
fi
|
|
||||||
# Add addn-host= to dnsmasq
|
# Add addn-host= to dnsmasq
|
||||||
echo "addn-hosts=/etc/pihole/gravity.list" >> /etc/dnsmasq.d/01-pihole.conf
|
echo "addn-hosts=/etc/pihole/gravity.list" >> /etc/dnsmasq.d/01-pihole.conf
|
||||||
restartDNS
|
restartDNS
|
||||||
@ -561,7 +564,7 @@ tricorderFunc() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! timeout 2 nc -z tricorder.pi-hole.net 9998 &> /dev/null; then
|
if ! (echo > /dev/tcp/tricorder.pi-hole.net/9998) >/dev/null 2>&1; then
|
||||||
echo -e " ${CROSS} Unable to connect to Pi-hole's Tricorder server"
|
echo -e " ${CROSS} Unable to connect to Pi-hole's Tricorder server"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -651,7 +654,7 @@ case "${1}" in
|
|||||||
"uninstall" ) uninstallFunc;;
|
"uninstall" ) uninstallFunc;;
|
||||||
"enable" ) piholeEnable 1;;
|
"enable" ) piholeEnable 1;;
|
||||||
"disable" ) piholeEnable 0 "$2";;
|
"disable" ) piholeEnable 0 "$2";;
|
||||||
"status" ) piholeStatus "$2";;
|
"status" ) statusFunc "$2";;
|
||||||
"restartdns" ) restartDNS;;
|
"restartdns" ) restartDNS;;
|
||||||
"-a" | "admin" ) webpageFunc "$@";;
|
"-a" | "admin" ) webpageFunc "$@";;
|
||||||
"-t" | "tail" ) tailFunc;;
|
"-t" | "tail" ) tailFunc;;
|
||||||
|
Loading…
Reference in New Issue
Block a user