From 11f342587656937f0baa8960cbd785994ceeaaec Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Thu, 22 Mar 2018 23:51:12 -0500
Subject: [PATCH 01/28] update donation and affiliate links. also link to
trademark guidelines. update an image. and add a project.
Signed-off-by: Jacob Salmela
---
README.md | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index b7f4f249..b5e24378 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
Network-wide ad blocking via your own Linux hardware
-The Pi-hole is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content, without installing any client-side software.
+The Pi-hole[®](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content, without installing any client-side software.
- **Easy-to-install**: our versatile installer walks you through the process, and [takes less than ten minutes](https://www.youtube.com/watch?v=vKWjx1AQYgs)
- **Resolute**: content is blocked in _non-browser locations_, such as ad-laden mobile apps and smart TVs
@@ -27,7 +27,7 @@ Those who want to get started quickly and conveniently, may install Pi-hole usin
#### `curl -sSL https://install.pi-hole.net | bash`
## Alternative Install Methods
-[Piping to `bash` is controversial](https://pi-hole.net/2016/07/25/curling-and-piping-to-bash), as it prevents you from [reading code that is about to run](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) on your system. Therefore, we provide these alternative installation methods which allow code review before installation:
+[Piping to `bash` is controversial](https://pi-hole.net/2016/07/25/curling-and-piping-to-bash), as it prevents you from [reading code that is about to run](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) on your system. Therefore, we provide these alternative installation methods which allow code review before installation:
### Method 1: Clone our repository and run
```
@@ -60,16 +60,21 @@ Make no mistake: **your support is absolutely vital to help keep us innovating!*
### Donations
Sending a donation using our links below is **extremely helpful** in offsetting a portion of our monthly expenses:
- Donate via PayPal
- Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
+- Donate via PayPal
+- [Bitcoin](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
+- [Bitcoin Cash](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): qqh25hlmqaj99xraw00e47xmf8sysnyxhyww2d7dnh
+- [Ethereum](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): 0xF00aF43d2431BAD585056492b310e48eC40D87e8
### Alternative support
-If you'd rather not donate (_which is okay!_), there are other ways you can help support us:
+If you'd rather not [donate](https://pi-hole.net/donate/) (_which is okay!_), there are other ways you can help support us:
-- [Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) affiliate link
-- [Vultr](http://www.vultr.com/?ref=7190426) affiliate link
-- [UNIXstickers.com](http://unixstickers.refr.cc/jacobs) affiliate link
-- [Pi-hole Swag Store](https://pi-hole.net/shop/)
+- [Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_
+- [UNIXstickers.com](http://unixstickers.refr.cc/jacobs) _save $5 when you spend $9 using our affiliate link_
+- [Pi-hole Swag Store](https://pi-hole.net/shop/) _affiliate link_
+- [Amazon](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_
+- [Ho-ost](https://clients.ho-ost.com/aff.php?aff=19) _save 50% with our affiliate link_
+- [DNS Made Easy](https://cp.dnsmadeeasy.com/u/133706) _affiliate link_
+- [Vultr](http://www.vultr.com/?ref=7190426) _affiliate link_
- Spreading the word about our software, and how you have benefited from it
### Contributing via GitHub
@@ -127,7 +132,7 @@ You can read our [Core Feature Breakdown](https://github.com/pi-hole/pi-hole/wik
### The Web Interface Dashboard
This [optional dashboard](https://github.com/pi-hole/AdminLTE) allows you to view stats, change settings, and configure your Pi-hole. It's the power of the Command Line Interface, with none of the learning curve!
-
+
Some notable features include:
* Mobile friendly interface
@@ -145,8 +150,8 @@ There are several ways to [access the dashboard](https://discourse.pi-hole.net/t
2. `http:/pi.hole/admin/` (when using Pi-hole as your DNS server)
3. `http://pi.hole/` (when using Pi-hole as your DNS server)
-## The Faster-Than-Light Engine
-The [FTL Engine](https://github.com/pi-hole/FTL) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTL does this all *very quickly*!
+## Faster-than-light Engine
+The FTLDNS[™](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTLDNS does this all *very quickly*!
Some of the statistics you can integrate include:
* Total number of domains being blocked
@@ -194,6 +199,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http
- [Magic Mirror with DNS Filtering](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
- [Pi-hole Droid: Android client](https://github.com/friimaind/pi-hole-droid)
- [Windows DNS Swapper](https://github.com/roots84/DNS-Swapper), see [#1400](https://github.com/pi-hole/pi-hole/issues/1400)
+- [Pi-hole Visualizer](https://www.reddit.com/r/pihole/comments/82ikgb/pihole_visualizer_update/)
-----
## Coverage
From 284f9e3f2f9141e2a7a16b252abd447217b824d6 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 11 Apr 2018 20:38:56 -0500
Subject: [PATCH 02/28] implement mcats request. removed 'the'
Signed-off-by: Jacob Salmela
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b5e24378..ceeadb30 100644
--- a/README.md
+++ b/README.md
@@ -151,7 +151,7 @@ There are several ways to [access the dashboard](https://discourse.pi-hole.net/t
3. `http://pi.hole/` (when using Pi-hole as your DNS server)
## Faster-than-light Engine
-The FTLDNS[™](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTLDNS does this all *very quickly*!
+FTLDNS[™](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTLDNS does this all *very quickly*!
Some of the statistics you can integrate include:
* Total number of domains being blocked
From 8e82bf69d8b60dd784fe9f72fba3c1f4d6d149bd Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 11 Apr 2018 20:40:35 -0500
Subject: [PATCH 03/28] update wallet addresses
Signed-off-by: Jacob Salmela
---
README.md | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index ceeadb30..5119fd8c 100644
--- a/README.md
+++ b/README.md
@@ -61,9 +61,10 @@ Make no mistake: **your support is absolutely vital to help keep us innovating!*
Sending a donation using our links below is **extremely helpful** in offsetting a portion of our monthly expenses:
- Donate via PayPal
-- [Bitcoin](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
-- [Bitcoin Cash](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): qqh25hlmqaj99xraw00e47xmf8sysnyxhyww2d7dnh
-- [Ethereum](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): 0xF00aF43d2431BAD585056492b310e48eC40D87e8
+- [Bitcoin](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763):
+3MDPzjXu2hjw5sGLJvKUi1uXbvQPzVrbpF
+- [Bitcoin Cash](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): qzqsz4aju2eecc6uhs7tus4vlwhhela24sdruf4qp5
+- [Ethereum](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): 0x79d4e90A4a0C732819526c93e21A3F1356A2FAe1
### Alternative support
If you'd rather not [donate](https://pi-hole.net/donate/) (_which is okay!_), there are other ways you can help support us:
From 3a483a1b203d4f4bc2a913d97c9a33562cc2e7cf Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Sun, 15 Apr 2018 02:08:16 +0100
Subject: [PATCH 04/28] install_web_server
+ Splits web interface and server into two variables.
+ Option to disable forced install of Lighttpd.
---
advanced/Scripts/piholeCheckout.sh | 2 +-
advanced/Scripts/update.sh | 4 +-
automated install/basic-install.sh | 119 +++++++++++++++--------------
automated install/uninstall.sh | 9 +--
4 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index 21919ddf..e7bc244e 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -222,7 +222,7 @@ checkout() {
Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
exit 1;
fi
- if [[ "${INSTALL_WEB}" == "true" ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == "true" ]]; then
if ! is_repo "${webInterfaceDir}" ; then
echo -e " ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!
Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index a4ada4c8..c8a2bffb 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -94,7 +94,7 @@ main() {
local pihole_version_current
local web_version_current
local basicError="\\n ${COL_LIGHT_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
-
+
# shellcheck disable=1090,2154
source "${setupVars}"
@@ -133,7 +133,7 @@ main() {
echo ""
fi
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
echo -e "\\n ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!
Please re-run install script from https://pi-hole.net${COL_NC}"
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index f786d703..79fe17bf 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -55,7 +55,7 @@ IPV4_ADDRESS=""
IPV6_ADDRESS=""
# By default, query logging is enabled and the dashboard is set to be installed
QUERY_LOGGING=true
-INSTALL_WEB=true
+INSTALL_WEB_INTERFACE=true
# Find the rows and columns will default to 80x24 if it can not be detected
@@ -76,6 +76,16 @@ c=$(( c < 70 ? 70 : c ))
skipSpaceCheck=false
reconfigure=false
runUnattended=false
+INSTALL_WEB_SERVER=true
+# Check arguments for the undocumented flags
+for var in "$@"; do
+ case "$var" in
+ "--reconfigure" ) reconfigure=true;;
+ "--i_do_not_follow_recommendations" ) skipSpaceCheck=true;;
+ "--unattended" ) runUnattended=true;;
+ "--disable-install-webserver" ) INSTALL_WEB_SERVER=false;;
+ esac
+done
# If the color table file exists,
if [[ -f "${coltable}" ]]; then
@@ -948,12 +958,13 @@ setAdminFlag() {
"On (Recommended)")
echo -e " ${INFO} Web Interface On"
# Set it to true
- INSTALL_WEB=true
+ INSTALL_WEB_INTERFACE=true
;;
Off)
echo -e " ${INFO} Web Interface Off"
# or false
- INSTALL_WEB=false
+ INSTALL_WEB_INTERFACE=false
+ INSTALL_WEB_SERVER=false
;;
esac
}
@@ -1092,7 +1103,7 @@ installConfigs() {
version_check_dnsmasq
# If the user chose to install the dashboard,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# and if the Web server conf directory does not exist,
if [[ ! -d "/etc/lighttpd" ]]; then
# make it
@@ -1455,7 +1466,7 @@ configureFirewall() {
#
finalExports() {
# If the Web interface is not set to be installed,
- if [[ "${INSTALL_WEB}" == false ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == false ]]; then
# and if there is not an IPv4 address,
if [[ "${IPV4_ADDRESS}" ]]; then
# there is no block page, so set IPv4 to 0.0.0.0 (all IP addresses)
@@ -1470,7 +1481,7 @@ finalExports() {
# If the setup variable file exists,
if [[ -e "${setupVars}" ]]; then
# update the variables in the file
- sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
+ sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
fi
# echo the information to the user
{
@@ -1480,7 +1491,8 @@ finalExports() {
echo "PIHOLE_DNS_1=${PIHOLE_DNS_1}"
echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}"
echo "QUERY_LOGGING=${QUERY_LOGGING}"
- echo "INSTALL_WEB=${INSTALL_WEB}"
+ echo "INSTALL_WEB_SERVER=${INSTALL_WEB_SERVER}"
+ echo "INSTALL_WEB_INTERFACE=${INSTALL_WEB_INTERFACE}"
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
}>> "${setupVars}"
@@ -1524,25 +1536,28 @@ installPihole() {
create_pihole_user
# If the user wants to install the Web interface,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
if [[ ! -d "/var/www/html" ]]; then
# make the Web directory if necessary
mkdir -p /var/www/html
fi
- # Set the owner and permissions
- chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/www/html
- chmod 775 /var/www/html
- # Give pihole access to the Web server group
- usermod -a -G ${LIGHTTPD_GROUP} pihole
- # If the lighttpd command is executable,
- if [[ -x "$(command -v lighty-enable-mod)" ]]; then
- # enable fastcgi and fastcgi-php
- lighty-enable-mod fastcgi fastcgi-php > /dev/null || true
- else
- # Othweise, show info about installing them
- echo -e " ${INFO} Warning: 'lighty-enable-mod' utility not found
- Please ensure fastcgi is enabled if you experience issues\\n"
- fi
+
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
+ # Set the owner and permissions
+ chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/www/html
+ chmod 775 /var/www/html
+ # Give pihole access to the Web server group
+ usermod -a -G ${LIGHTTPD_GROUP} pihole
+ # If the lighttpd command is executable,
+ if [[ -x "$(command -v lighty-enable-mod)" ]]; then
+ # enable fastcgi and fastcgi-php
+ lighty-enable-mod fastcgi fastcgi-php > /dev/null || true
+ else
+ # Othweise, show info about installing them
+ echo -e " ${INFO} Warning: 'lighty-enable-mod' utility not found
+ Please ensure fastcgi is enabled if you experience issues\\n"
+ fi
+ fi
fi
# Install scripts,
installScripts
@@ -1551,7 +1566,7 @@ installPihole() {
# and create the log file
CreateLogFile
# If the user wants to install the dashboard,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# do so
installPiholeWeb
fi
@@ -1589,7 +1604,7 @@ updatePihole() {
# Create the log file
CreateLogFile
# If the user wants to install the dasboard,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# do so
installPiholeWeb
fi
@@ -1639,7 +1654,7 @@ displayFinalMessage() {
pwstring="NOT SET"
fi
# If the user wants to install the dashboard,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# Store a message in a variable and display it
additional="View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin
@@ -1707,7 +1722,7 @@ clone_or_update_repos() {
exit 1; \
}
# If the Web interface was installed,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# reset it's repo
resetRepo ${webInterfaceDir} || \
{ echo -e " ${COL_LIGHT_RED}Unable to reset ${webInterfaceDir}, exiting installer${COL_NC}"; \
@@ -1722,7 +1737,7 @@ clone_or_update_repos() {
exit 1; \
}
# If the Web interface was installed,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# get the Web git files
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} || \
{ echo -e " ${COL_LIGHT_RED}Unable to clone ${webInterfaceGitUrl} into ${webInterfaceDir}, exiting installer${COL_NC}"; \
@@ -1950,15 +1965,6 @@ main() {
# Check for supported distribution
distro_check
- # Check arguments for the undocumented flags
- for var in "$@"; do
- case "$var" in
- "--reconfigure" ) reconfigure=true;;
- "--i_do_not_follow_recommendations" ) skipSpaceCheck=true;;
- "--unattended" ) runUnattended=true;;
- esac
- done
-
# If the setup variable file exists,
if [[ -f "${setupVars}" ]]; then
# if it's running unattended,
@@ -2000,7 +2006,7 @@ main() {
mkdir -p /etc/pihole/
stop_service dnsmasq
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
stop_service lighttpd
fi
# Determine available interfaces
@@ -2018,21 +2024,19 @@ main() {
# Clone/Update the repos
clone_or_update_repos
- # Install packages used by the Pi-hole
- if [[ "${INSTALL_WEB}" == true ]]; then
+ # Install the Core dependencies
+ local dep_install_list=("${PIHOLE_DEPS[@]}")
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# Install the Web dependencies
- DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
- # Otherwise,
- else
- # just install the Core dependencies
- DEPS=("${PIHOLE_DEPS[@]}")
+ dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
fi
- install_dependent_packages DEPS[@]
+ install_dependent_packages dep_install_list[@]
+ unset dep_install_list
# On some systems, lighttpd is not enabled on first install. We need to enable it here if the user
# has chosen to install the web interface, else the `LIGHTTPD_ENABLED` check will fail
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
enable_service lighttpd
fi
@@ -2053,16 +2057,15 @@ main() {
# Clone/Update the repos
clone_or_update_repos
- # Install packages used by the Pi-hole
- if [[ "${INSTALL_WEB}" == true ]]; then
+ # Install the Core dependencies
+ local dep_install_list=("${PIHOLE_DEPS[@]}")
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# Install the Web dependencies
- DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
- # Otherwise,
- else
- # just install the Core dependencies
- DEPS=("${PIHOLE_DEPS[@]}")
+ dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
fi
- install_dependent_packages DEPS[@]
+
+ install_dependent_packages dep_install_list[@]
+ unset dep_install_list
if [[ -x "$(command -v systemctl)" ]]; then
# Value will either be 1, if true, or 0
@@ -2077,7 +2080,7 @@ main() {
# Copy the temp log file into final log location for storage
copy_to_install_log
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# Add password to web UI if there is none
pw=""
# If no password is set,
@@ -2096,7 +2099,7 @@ main() {
enable_service dnsmasq
# If the Web server was installed,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
if [[ "${LIGHTTPD_ENABLED}" == "1" ]]; then
start_service lighttpd
@@ -2123,7 +2126,7 @@ main() {
fi
# If the Web interface was installed,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
# If there is a password,
if (( ${#pw} > 0 )) ; then
# display the password
@@ -2135,7 +2138,7 @@ main() {
#
if [[ "${useUpdateVars}" == false ]]; then
# If the Web interface was installed,
- if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
echo -e " View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin"
echo ""
fi
diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh
index 2f4f4f9f..2f4c58a1 100755
--- a/automated install/uninstall.sh
+++ b/automated install/uninstall.sh
@@ -46,13 +46,10 @@ source "${setupVars}"
distro_check
# Install packages used by the Pi-hole
-if [[ "${INSTALL_WEB}" == true ]]; then
+DEPS=("${INSTALLER_DEPS[@]}" "${PIHOLE_DEPS[@]}")
+if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# Install the Web dependencies
- DEPS=("${INSTALLER_DEPS[@]}" "${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
-# Otherwise,
-else
- # just install the Core dependencies
- DEPS=("${INSTALLER_DEPS[@]}" "${PIHOLE_DEPS[@]}")
+ DEPS+=("${PIHOLE_WEB_DEPS[@]}")
fi
# Compatability
From 88d4108f920740e0408ccc4703330d3364b5b6fd Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 17 Apr 2018 09:50:25 +0100
Subject: [PATCH 05/28] - 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
---
adlists.default | 23 ------------------
automated install/basic-install.sh | 38 ++++++++++++++++++++++++++++++
gravity.sh | 6 +----
3 files changed, 39 insertions(+), 28 deletions(-)
delete mode 100644 adlists.default
diff --git a/adlists.default b/adlists.default
deleted file mode 100644
index cbc1bfb3..00000000
--- a/adlists.default
+++ /dev/null
@@ -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
-
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 160039ce..87e10751 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -49,6 +49,7 @@ PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update versi
PI_HOLE_INSTALL_DIR="/opt/pihole"
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
# this script can run
IPV4_ADDRESS=""
@@ -955,6 +956,39 @@ setAdminFlag() {
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
version_check_dnsmasq() {
# Local, named variables
@@ -2100,6 +2134,10 @@ main() {
chooseInterface
# Decide what upstream DNS Servers to use
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
use4andor6
# Let the user decide if they want the web interface to be installed automatically
diff --git a/gravity.sh b/gravity.sh
index 5806dea7..848fe574 100755
--- a/gravity.sh
+++ b/gravity.sh
@@ -20,11 +20,9 @@ basename="pihole"
PIHOLE_COMMAND="/usr/local/bin/${basename}"
piholeDir="/etc/${basename}"
-piholeRepo="/etc/.${basename}"
adListFile="${piholeDir}/adlists.list"
adListDefault="${piholeDir}/adlists.default"
-adListRepoDefault="${piholeRepo}/adlists.default"
whitelistFile="${piholeDir}/whitelist.txt"
blacklistFile="${piholeDir}/blacklist.txt"
@@ -133,9 +131,7 @@ gravity_GetBlocklistUrls() {
# Determine if adlists file needs handling
if [[ ! -f "${adListFile}" ]]; then
- # Create "adlists.list" by copying "adlists.default" from internal core repo
- cp "${adListRepoDefault}" "${adListFile}" 2> /dev/null || \
- echo -e " ${CROSS} Unable to copy ${adListFile##*/} from ${piholeRepo}"
+ echo -e " ${CROSS} No adlists file found. Nothing to do!"
elif [[ -f "${adListDefault}" ]] && [[ -f "${adListFile}" ]]; then
# Remove superceded $adListDefault file
rm "${adListDefault}" 2> /dev/null || \
From 2e4f49a223cc2ef83aca361eaa92d50fda05f6b6 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 17 Apr 2018 16:22:10 +0100
Subject: [PATCH 06/28] Default all to on, change up wording. This commit can
be rolled back, it's just an option!
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 87e10751..cce15fa3 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -959,15 +959,15 @@ setAdminFlag() {
# 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)
+ cmd=(whiptail --separate-output --checklist "Pi-hole relies on third party lists in order to block ads.\\n\\nYou can use the suggestions below, and/or add your own after installation\\n\\nTo deselect any list, use the arrow keys and spacebar" "${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)
+ options=(StevenBlack "StevenBlack's Unified Hosts List" on
+ MalwareDom "MalwareDomains" on
+ Cameleon "Cameleon" on
+ ZeusTracker "ZeusTracker" on
+ DisconTrack "Disconnect.me Tracking" on
+ DisconAd "Disconnect.me Ads" on
+ HostsFile "Hosts-file.net Ads" on)
# 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; }
@@ -984,9 +984,7 @@ chooseBlocklists() {
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
-
-
+ done
}
# Check if /etc/dnsmasq.conf is from pi-hole. If so replace with an original and install new in .d directory
From b6b1dcb275021674ad030709a83a22b563adce4d Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 17 Apr 2018 19:35:46 +0100
Subject: [PATCH 07/28] delete adlists.list if user cancels out of this dialog
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index cce15fa3..5b274e47 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -957,10 +957,10 @@ setAdminFlag() {
}
# A function to display a list of example blocklists for users to select
-chooseBlocklists() {
+chooseBlocklists() {
# Let user select (or not) blocklists via a checklist
cmd=(whiptail --separate-output --checklist "Pi-hole relies on third party lists in order to block ads.\\n\\nYou can use the suggestions below, and/or add your own after installation\\n\\nTo deselect any list, use the arrow keys and spacebar" "${r}" "${c}" 7)
- # In an array, show the options available (all off by default):
+ # In an array, show the options available (all off by default):
options=(StevenBlack "StevenBlack's Unified Hosts List" on
MalwareDom "MalwareDomains" on
Cameleon "Cameleon" on
@@ -970,7 +970,7 @@ chooseBlocklists() {
HostsFile "Hosts-file.net Ads" on)
# 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; }
+ choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || { echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}"; rm "${adlistFile}" ;exit 1; }
# For each choice available,
for choice in ${choices}
do
From 7455ac9bfbb60054cec5c88247ba934ab3dd7ab4 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 17 Apr 2018 19:46:36 +0100
Subject: [PATCH 08/28] Run chooseBlocklists on EVERY reconfigure, not only if
the adlist file does not esist.
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 5b274e47..7faed6d3 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -958,6 +958,10 @@ setAdminFlag() {
# A function to display a list of example blocklists for users to select
chooseBlocklists() {
+ # Back up any existing adlist file, on the off chance that it exists. Useful in case of a reconfigure.
+ if [[ -f "${adlistFile}" ]]; then
+ mv "${adlistFile}" "${adlistFile}.old"
+ fi
# Let user select (or not) blocklists via a checklist
cmd=(whiptail --separate-output --checklist "Pi-hole relies on third party lists in order to block ads.\\n\\nYou can use the suggestions below, and/or add your own after installation\\n\\nTo deselect any list, use the arrow keys and spacebar" "${r}" "${c}" 7)
# In an array, show the options available (all off by default):
@@ -1708,7 +1712,7 @@ update_dialogs() {
strAdd="You will be updated to the latest version."
fi
opt2a="Reconfigure"
- opt2b="This will allow you to enter new settings"
+ opt2b="This will reset your Pi-hole and allow you to enter new settings."
# Display the information to the user
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\\n\\nWe have detected an existing install.\\n\\nPlease choose from the following options: \\n($strAdd)" ${r} ${c} 2 \
@@ -2132,10 +2136,8 @@ main() {
chooseInterface
# Decide what upstream DNS Servers to use
setDNS
- # If adlists.list file does not exist, give the user the choice of adding some example lists
- if [[ ! -f "${adlistFile}" ]]; then
- chooseBlocklists
- fi
+ # Give the user a choice of blocklists to include in their install. Or not.
+ chooseBlocklists
# Let the user decide if they want to block ads over IPv4 and/or IPv6
use4andor6
# Let the user decide if they want the web interface to be installed automatically
From e401651f0974810e596ed486a4eecaaf3f8c6e27 Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Wed, 18 Apr 2018 04:11:32 +0100
Subject: [PATCH 09/28] Update https://github.com/pi-hole/pi-hole/pull/2115
+ Patch existing systems with the new variable changes using
'accountForRefactor'
+ Prompt user to install webserver
---
automated install/basic-install.sh | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 79fe17bf..2ea37528 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -964,9 +964,25 @@ setAdminFlag() {
echo -e " ${INFO} Web Interface Off"
# or false
INSTALL_WEB_INTERFACE=false
- INSTALL_WEB_SERVER=false
;;
esac
+
+ # Request user to install web server, if --disable-install-webserver has not been used (INSTALL_WEB_SERVER=true is default).
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
+ WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web server (lighttpd)?" ${r} ${c} 6)
+ # with the default being enabled
+ WebChooseOptions=("On (Recommended)" "" on
+ Off "" off)
+ WebChoices=$("${WebToggleCommand[@]}" "${WebChooseOptions[@]}" 2>&1 >/dev/tty) || (echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}" && exit 1)
+ # Depending on their choice
+ case ${WebChoices} in
+ Off)
+ echo -e " ${INFO} Web Server Off"
+ # or false
+ INSTALL_WEB_SERVER=false
+ ;;
+ esac
+ fi
}
# Check if /etc/dnsmasq.conf is from pi-hole. If so replace with an original and install new in .d directory
@@ -1593,6 +1609,15 @@ accountForRefactor() {
sed -i 's/piholeIPv6/IPV6_ADDRESS/g' ${setupVars}
sed -i 's/piholeDNS1/PIHOLE_DNS_1/g' ${setupVars}
sed -i 's/piholeDNS2/PIHOLE_DNS_2/g' ${setupVars}
+ sed -i 's/^INSTALL_WEB=/INSTALL_WEB_INTERFACE=/' ${setupVars}
+ # Add 'INSTALL_WEB_SERVER', if its not been applied already: https://github.com/pi-hole/pi-hole/pull/2115
+ if ! grep -q '^INSTALL_WEB_SERVER=' ${setupVars}; then
+ local webserver_installed=false
+ if grep -q '^INSTALL_WEB_INTERFACE=true' ${setupVars}; then
+ webserver_installed=true
+ fi
+ echo -e "INSTALL_WEB_SERVER=$webserver_installed" >> ${setupVars}
+ fi
}
updatePihole() {
From 47c1071bb890407c6ba936673633fa48218b7416 Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Wed, 18 Apr 2018 04:24:48 +0100
Subject: [PATCH 10/28] Minor
+ Add info in regards to disabling web server install:
https://github.com/pi-hole/pi-hole/pull/2115
---
automated install/basic-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 2ea37528..7b264320 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -969,7 +969,7 @@ setAdminFlag() {
# Request user to install web server, if --disable-install-webserver has not been used (INSTALL_WEB_SERVER=true is default).
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web server (lighttpd)?" ${r} ${c} 6)
+ WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web server (lighttpd)?\n\nNB: If you disable this, and, do not have an existing webserver installed, the web interface will not function." ${r} ${c} 6)
# with the default being enabled
WebChooseOptions=("On (Recommended)" "" on
Off "" off)
From c2c1dc74693fbf7d9e13208e63d0dc271a91deee Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Wed, 18 Apr 2018 04:38:07 +0100
Subject: [PATCH 11/28] Ensuring bot pleasure
https://github.com/pi-hole/pi-hole/pull/2115#pullrequestreview-113066748
---
automated install/basic-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 7b264320..d3330995 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -969,7 +969,7 @@ setAdminFlag() {
# Request user to install web server, if --disable-install-webserver has not been used (INSTALL_WEB_SERVER=true is default).
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web server (lighttpd)?\n\nNB: If you disable this, and, do not have an existing webserver installed, the web interface will not function." ${r} ${c} 6)
+ WebToggleCommand=(whiptail --separate-output --radiolist "Do you wish to install the web server (lighttpd)?\\n\\nNB: If you disable this, and, do not have an existing webserver installed, the web interface will not function." "${r}" "${c}" 6)
# with the default being enabled
WebChooseOptions=("On (Recommended)" "" on
Off "" off)
From 255cfb7d626633fa99a9f00b6e1662b8b23a2fca Mon Sep 17 00:00:00 2001
From: Rowan
Date: Thu, 19 Apr 2018 19:30:30 +0100
Subject: [PATCH 12/28] Fixed typo in README
Signed-off-by: Rowan Wookey
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5119fd8c..60c54f87 100644
--- a/README.md
+++ b/README.md
@@ -148,7 +148,7 @@ Some notable features include:
There are several ways to [access the dashboard](https://discourse.pi-hole.net/t/how-do-i-access-pi-holes-dashboard-admin-interface/3168):
1. `http:///admin/`
-2. `http:/pi.hole/admin/` (when using Pi-hole as your DNS server)
+2. `http://pi.hole/admin/` (when using Pi-hole as your DNS server)
3. `http://pi.hole/` (when using Pi-hole as your DNS server)
## Faster-than-light Engine
From 55fce489bc46ffe9c977ca78ab3b79641bcb569c Mon Sep 17 00:00:00 2001
From: Michele Bologna
Date: Thu, 19 Apr 2018 23:31:43 +0200
Subject: [PATCH 13/28] Fix: add psmisc as dependency
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Debian 9.4 does not install `psmisc` by default and the following error will happen during installation:
```
[✗] /usr/local/bin/pihole: line 353: killall: command not found
/usr/local/bin/pihole: line 364: killall: command not found
```
This patch adds `psmisc` (that contains `killall`) as dependency
Signed-off-by: Michele Bologna
---
automated install/basic-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 160039ce..c473d0c9 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -163,7 +163,7 @@ if command -v apt-get &> /dev/null; then
# These programs are stored in an array so they can be looped through later
INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
# Pi-hole itself has several dependencies that also need to be installed
- PIHOLE_DEPS=(bc cron curl dnsutils iputils-ping lsof netcat sudo unzip wget idn2 sqlite3 libcap2-bin dns-root-data resolvconf)
+ PIHOLE_DEPS=(bc cron curl dnsutils iputils-ping lsof netcat psmisc sudo unzip wget idn2 sqlite3 libcap2-bin dns-root-data resolvconf)
# The Web dashboard has some that also need to be installed
# It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi ${phpVer}-${phpSqlite})
@@ -1589,7 +1589,7 @@ updatePihole() {
# Install base files and web interface
installScripts
# Install config files
- installConfigs
+ installConfigs
# If the user wants to install the dasboard,
if [[ "${INSTALL_WEB}" == true ]]; then
# do so
From eccea8a911b3e1714b3feea9596c1c958e6bf0c0 Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Sat, 21 Apr 2018 08:27:31 +0100
Subject: [PATCH 14/28] Minor
+ Fix indentation
+ Stick with case, add "On" to provide INFO print out, although its not
technically required as INSTALL_WEB_SERVER=true is default value.
---
automated install/basic-install.sh | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index d3330995..4cc106fe 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -974,15 +974,20 @@ setAdminFlag() {
WebChooseOptions=("On (Recommended)" "" on
Off "" off)
WebChoices=$("${WebToggleCommand[@]}" "${WebChooseOptions[@]}" 2>&1 >/dev/tty) || (echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}" && exit 1)
- # Depending on their choice
- case ${WebChoices} in
- Off)
- echo -e " ${INFO} Web Server Off"
- # or false
- INSTALL_WEB_SERVER=false
- ;;
- esac
- fi
+ # Depending on their choice
+ case ${WebChoices} in
+ "On (Recommended)")
+ echo -e " ${INFO} Web Server On"
+ # set it to true, as clearly seen below.
+ INSTALL_WEB_SERVER=true
+ ;;
+ Off)
+ echo -e " ${INFO} Web Server Off"
+ # or false
+ INSTALL_WEB_SERVER=false
+ ;;
+ esac
+ fi
}
# Check if /etc/dnsmasq.conf is from pi-hole. If so replace with an original and install new in .d directory
From 60bcca54eb2b0f89fc897a83e4ff94ca39ca2927 Mon Sep 17 00:00:00 2001
From: "Daniel (Fourdee)"
Date: Sat, 21 Apr 2018 08:29:21 +0100
Subject: [PATCH 15/28] Minor
+ indentation
---
automated install/basic-install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 4cc106fe..2429c6f3 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -979,12 +979,12 @@ setAdminFlag() {
"On (Recommended)")
echo -e " ${INFO} Web Server On"
# set it to true, as clearly seen below.
- INSTALL_WEB_SERVER=true
+ INSTALL_WEB_SERVER=true
;;
Off)
echo -e " ${INFO} Web Server Off"
# or false
- INSTALL_WEB_SERVER=false
+ INSTALL_WEB_SERVER=false
;;
esac
fi
From 72c081cfd65a6baa203deb16c4541f77d83a2240 Mon Sep 17 00:00:00 2001
From: Fauxsys
Date: Sun, 10 Dec 2017 23:51:54 -0500
Subject: [PATCH 16/28] Fix for unattended installations #1767 #1768 #1834
Removed updatePihole() function and updated if/then statements in installPihole() and main(). Corrected minor typos.
Signed-off-by: Fauxsys
---
automated install/basic-install.sh | 208 ++++++++++++-----------------
1 file changed, 84 insertions(+), 124 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index b9a23a72..8b12deb0 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -169,7 +169,7 @@ if command -v apt-get &> /dev/null; then
else
phpSqlite="sqlite"
fi
- # Since our install script is so large, we need several other programs to successfuly get a machine provisioned
+ # Since our install script is so large, we need several other programs to successfully get a machine provisioned
# These programs are stored in an array so they can be looped through later
INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
# Pi-hole itself has several dependencies that also need to be installed
@@ -236,7 +236,7 @@ fi
# A function for checking if a folder is a git repository
is_repo() {
- # Use a named, local variable instead of the vague $1, which is the first arguement passed to this function
+ # 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
local directory="${1}"
# A local variable for the current directory
@@ -312,7 +312,7 @@ update_repo() {
git pull --quiet &> /dev/null || return $?
# Show a completion message
echo -e "${OVER} ${TICK} ${str}"
- # Move back into the oiginal directory
+ # Move back into the original directory
cd "${curdir}" &> /dev/null || return 1
return 0
}
@@ -324,7 +324,7 @@ getGitFiles() {
local directory="${1}"
# as well as the repo URL
local remoteRepo="${2}"
- # A local varible containing the message to be displayed
+ # A local variable containing the message to be displayed
local str="Check for existing repository in ${1}"
# Show the message
echo -ne " ${INFO} ${str}..."
@@ -338,7 +338,7 @@ getGitFiles() {
else
# Show an error
echo -e "${OVER} ${CROSS} ${str}"
- # Attempt to make the repository, showing an error on falure
+ # Attempt to make the repository, showing an error on failure
make_repo "${directory}" "${remoteRepo}" || { echo -e "\\n ${COL_LIGHT_RED}Error: Could not update local repository. Contact support.${COL_NC}"; exit 1; }
fi
# echo a blank line
@@ -349,11 +349,11 @@ getGitFiles() {
# Reset a repo to get rid of any local changed
resetRepo() {
- # Use named varibles for arguments
+ # Use named variables for arguments
local directory="${1}"
# Move into the directory
cd "${directory}" &> /dev/null || return 1
- # Store the message in a varible
+ # Store the message in a variable
str="Resetting repository within ${1}..."
# Show the message
echo -ne " ${INFO} ${str}"
@@ -391,7 +391,7 @@ get_available_interfaces() {
# A function for displaying the dialogs the user sees when first running the installer
welcomeDialogs() {
- # Display the welcome dialog using an approriately sized window via the calculation conducted earlier in the script
+ # Display the welcome dialog using an appropriately sized window via the calculation conducted earlier in the script
whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer" "\\n\\nThis installer will transform your device into a network-wide ad blocker!" ${r} ${c}
# Request that users donate if they enjoy the software since we all work on it in our free time
@@ -409,7 +409,7 @@ verifyFreeDiskSpace() {
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
# - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables.
local str="Disk space check"
- # Reqired space in KB
+ # Required space in KB
local required_free_kilobytes=51200
# Calculate existing free space on this machine
local existing_free_kilobytes
@@ -491,7 +491,7 @@ chooseInterface() {
chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface (press space to select)" ${r} ${c} ${interfaceCount})
# Now run the command using the interfaces saved into the array
chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty) || \
- # If the user chooses Canel, exit
+ # If the user chooses Cancel, exit
{ echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}"; exit 1; }
# For each interface
for desiredInterface in ${chooseInterfaceOptions}; do
@@ -747,7 +747,7 @@ valid_ip() {
# If the IP matches the format xxx.xxx.xxx.xxx,
if [[ "${ip}" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
- # Save the old Interfal Field Separator in a variable
+ # Save the old Internal Field Separator in a variable
OIFS=$IFS
# and set the new one to a dot (period)
IFS='.'
@@ -863,7 +863,7 @@ setDNS() {
fi
# Dialog for the user to enter custom upstream servers
- piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\\n\\nFor example '8.8.8.8, 8.8.4.4'" ${r} ${c} "${prePopulate}" 3>&1 1>&2 2>&3) || \
+ piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), separated by a comma.\\n\\nFor example '8.8.8.8, 8.8.4.4'" ${r} ${c} "${prePopulate}" 3>&1 1>&2 2>&3) || \
{ echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}"; exit 1; }
#
PIHOLE_DNS_1=$(echo "${piholeDNS}" | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
@@ -890,11 +890,11 @@ setDNS() {
fi
# Since the settings will not work, stay in the loop
DNSSettingsCorrect=False
- # Othwerise,
+ # Otherwise,
else
# Show the settings
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}); then
- # and break from the loop since the servers are vaid
+ # and break from the loop since the servers are valid
DNSSettingsCorrect=True
# Otherwise,
else
@@ -928,7 +928,7 @@ setLogging() {
# Set the GLOBAL variable to true so we know what they selected
QUERY_LOGGING=true
;;
- # Othwerise, it's off,
+ # Otherwise, it's off,
Off)
echo -e " ${INFO} Logging Off."
# So set it to false
@@ -1096,7 +1096,7 @@ installScripts() {
cd "${PI_HOLE_LOCAL_REPO}"
# Install the scripts by:
# -o setting the owner to the user
- # -Dm755 create all leading components of destiantion except the last, then copy the source to the destiantion and setting the permissions to 755
+ # -Dm755 create all leading components of destination except the last, then copy the source to the destination and setting the permissions to 755
#
# This first one is the directory
install -o "${USER}" -Dm755 -d "${PI_HOLE_INSTALL_DIR}"
@@ -1402,7 +1402,7 @@ installPiholeWeb() {
# If the Web server user is lighttpd,
if [[ "$LIGHTTPD_USER" == "lighttpd" ]]; then
# Allow executing pihole via sudo with Fedora
- # Usually /usr/local/bin is not permitted as directory for sudoable programms
+ # Usually /usr/local/bin is not permitted as directory for sudoable programs
echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin" >> /etc/sudoers.d/pihole
fi
# Set the strict permissions on the file
@@ -1456,11 +1456,11 @@ configureFirewall() {
echo ""
# If a firewall is running,
if firewall-cmd --state &> /dev/null; then
- # ask if the user wants to install Pi-hole's default firwall rules
+ # ask if the user wants to install Pi-hole's default firewall rules
whiptail --title "Firewall in use" --yesno "We have detected a running firewall\\n\\nPi-hole currently requires HTTP and DNS port access.\\n\\n\\n\\nInstall Pi-hole default firewall rules?" ${r} ${c} || \
{ echo -e " ${INFO} Not installing firewall rulesets."; return 0; }
echo -e " ${TICK} Configuring FirewallD for httpd and pihole-FTL"
- # Allow HTTP and DNS traffice
+ # Allow HTTP and DNS traffic
firewall-cmd --permanent --add-service=http --add-service=dns
# Reload the firewall to apply these changes
firewall-cmd --reload
@@ -1508,7 +1508,7 @@ finalExports() {
# If the setup variable file exists,
if [[ -e "${setupVars}" ]]; then
# update the variables in the file
- sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
+ sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
fi
# echo the information to the user
{
@@ -1557,6 +1557,27 @@ installLogrotate() {
echo -e "${OVER} ${TICK} ${str}"
}
+# At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break.
+# Refactoring of install script has changed the name of a couple of variables. Sort them out here.
+accountForRefactor() {
+ sed -i 's/piholeInterface/PIHOLE_INTERFACE/g' ${setupVars}
+ sed -i 's/IPv4_address/IPV4_ADDRESS/g' ${setupVars}
+ sed -i 's/IPv4addr/IPV4_ADDRESS/g' ${setupVars}
+ sed -i 's/IPv6_address/IPV6_ADDRESS/g' ${setupVars}
+ sed -i 's/piholeIPv6/IPV6_ADDRESS/g' ${setupVars}
+ sed -i 's/piholeDNS1/PIHOLE_DNS_1/g' ${setupVars}
+ sed -i 's/piholeDNS2/PIHOLE_DNS_2/g' ${setupVars}
+ sed -i 's/^INSTALL_WEB=/INSTALL_WEB_INTERFACE=/' ${setupVars}
+ # Add 'INSTALL_WEB_SERVER', if its not been applied already: https://github.com/pi-hole/pi-hole/pull/2115
+ if ! grep -q '^INSTALL_WEB_SERVER=' ${setupVars}; then
+ local webserver_installed=false
+ if grep -q '^INSTALL_WEB_INTERFACE=true' ${setupVars}; then
+ webserver_installed=true
+ fi
+ echo -e "INSTALL_WEB_SERVER=$webserver_installed" >> ${setupVars}
+ fi
+}
+
# Install base files and web interface
installPihole() {
# Create the pihole user
@@ -1580,15 +1601,19 @@ installPihole() {
# enable fastcgi and fastcgi-php
lighty-enable-mod fastcgi fastcgi-php > /dev/null || true
else
- # Othweise, show info about installing them
+ # Otherwise, show info about installing them
echo -e " ${INFO} Warning: 'lighty-enable-mod' utility not found
Please ensure fastcgi is enabled if you experience issues\\n"
fi
- fi
+ fi
fi
- # Install scripts,
+ # For updates and unattended install.
+ if [[ "${useUpdateVars}" == true ]]; then
+ accountForRefactor
+ fi
+ # Install base files and web interface
installScripts
- # configs,
+ # Install config files
installConfigs
# If the user wants to install the dashboard,
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
@@ -1602,57 +1627,14 @@ installPihole() {
# Check if FTL is installed
FTLdetect || echo -e " ${CROSS} FTL Engine not installed"
# Configure the firewall
- configureFirewall
+ if [[ "${useUpdateVars}" == false ]]; then
+ configureFirewall
+ fi
- #update setupvars.conf with any variables that may or may not have been changed during the install
+ # Update setupvars.conf with any variables that may or may not have been changed during the install
finalExports
}
-# At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break.
-# Refactoring of install script has changed the name of a couple of variables. Sort them out here.
-accountForRefactor() {
- sed -i 's/piholeInterface/PIHOLE_INTERFACE/g' ${setupVars}
- sed -i 's/IPv4_address/IPV4_ADDRESS/g' ${setupVars}
- sed -i 's/IPv4addr/IPV4_ADDRESS/g' ${setupVars}
- sed -i 's/IPv6_address/IPV6_ADDRESS/g' ${setupVars}
- sed -i 's/piholeIPv6/IPV6_ADDRESS/g' ${setupVars}
- sed -i 's/piholeDNS1/PIHOLE_DNS_1/g' ${setupVars}
- sed -i 's/piholeDNS2/PIHOLE_DNS_2/g' ${setupVars}
- sed -i 's/^INSTALL_WEB=/INSTALL_WEB_INTERFACE=/' ${setupVars}
- # Add 'INSTALL_WEB_SERVER', if its not been applied already: https://github.com/pi-hole/pi-hole/pull/2115
- if ! grep -q '^INSTALL_WEB_SERVER=' ${setupVars}; then
- local webserver_installed=false
- if grep -q '^INSTALL_WEB_INTERFACE=true' ${setupVars}; then
- webserver_installed=true
- fi
- echo -e "INSTALL_WEB_SERVER=$webserver_installed" >> ${setupVars}
- fi
-}
-
-updatePihole() {
- accountForRefactor
- # Install base files and web interface
- installScripts
- # Install config files
- installConfigs
- # If the user wants to install the dasboard,
- if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
- # do so
- installPiholeWeb
- fi
- # Install the cron file
- installCron
- # Install logrotate
- installLogrotate
- # Detect if FTL is installed
- FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
-
- #update setupvars.conf with any variables that may or may not have been changed during the install
- finalExports
-
-}
-
-
# SELinux
checkSelinux() {
# If the getenforce command exists,
@@ -1713,7 +1695,7 @@ update_dialogs() {
opt1a="Repair"
opt1b="This will retain existing settings"
strAdd="You will remain on the same version"
- # Othweise,
+ # Otherwise,
else
# set some variables with different values
opt1a="Update"
@@ -1853,7 +1835,7 @@ FTLinstall() {
fi
fi
return 0
- # Otherise,
+ # Otherwise,
else
# 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; }
@@ -2142,61 +2124,39 @@ main() {
setAdminFlag
# Let the user decide if they want query logging enabled...
setLogging
- # Clone/Update the repos
- clone_or_update_repos
-
- # Install the Core dependencies
- local dep_install_list=("${PIHOLE_DEPS[@]}")
- if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- # Install the Web dependencies
- dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
- fi
-
- install_dependent_packages dep_install_list[@]
- unset dep_install_list
-
- # On some systems, lighttpd is not enabled on first install. We need to enable it here if the user
- # has chosen to install the web interface, else the `LIGHTTPD_ENABLED` check will fail
- if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- enable_service lighttpd
- fi
-
- if [[ -x "$(command -v systemctl)" ]]; then
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
- else
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
- fi
-
- # Install and log everything to a file
- installPihole | tee -a /proc/$$/fd/3
else
# Source ${setupVars} to use predefined user variables in the functions
source ${setupVars}
-
- # Clone/Update the repos
- clone_or_update_repos
-
- # Install the Core dependencies
- local dep_install_list=("${PIHOLE_DEPS[@]}")
- if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- # Install the Web dependencies
- dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
- fi
-
- install_dependent_packages dep_install_list[@]
- unset dep_install_list
-
- if [[ -x "$(command -v systemctl)" ]]; then
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
- else
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
- fi
- updatePihole | tee -a /proc/$$/fd/3
fi
+ # Clone/Update the repos
+ clone_or_update_repos
+
+ # Install the Core dependencies
+ local dep_install_list=("${PIHOLE_DEPS[@]}")
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
+ # Install the Web dependencies
+ dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
+ fi
+
+ install_dependent_packages dep_install_list[@]
+ unset dep_install_list
+
+ # On some systems, lighttpd is not enabled on first install. We need to enable it here if the user
+ # has chosen to install the web interface, else the `LIGHTTPD_ENABLED` check will fail
+ if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
+ enable_service lighttpd
+ fi
+
+ if [[ -x "$(command -v systemctl)" ]]; then
+ # Value will either be 1, if true, or 0
+ LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
+ else
+ # Value will either be 1, if true, or 0
+ LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
+ fi
+
+ # Install and log everything to a file
+ installPihole | tee -a /proc/$$/fd/3
# Copy the temp log file into final log location for storage
copy_to_install_log
From 8ead0b54830e59cd090ec317227916d441f05f7d Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 23 Apr 2018 11:59:39 +0100
Subject: [PATCH 17/28] @fourdee dropped this: `/`
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index b9a23a72..50f112e6 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1508,7 +1508,7 @@ finalExports() {
# If the setup variable file exists,
if [[ -e "${setupVars}" ]]; then
# update the variables in the file
- sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
+ sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
fi
# echo the information to the user
{
From 1d8ea9e8693b4a1a38a1cf45516ce032c1130a1d Mon Sep 17 00:00:00 2001
From: bcambl
Date: Sun, 22 Apr 2018 13:53:15 -0600
Subject: [PATCH 18/28] Fix static IP checking on Fedora
This bug was introduced by #1758 where the CIDR was removed from the static IP check.
The CIDR was acting as a boundary so we need to test for a boundary or a slash character.
Signed-off-by: bcambl
---
automated install/basic-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index c473d0c9..2da8e785 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -689,7 +689,7 @@ setStaticIPv4() {
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}
IPADDR=$(echo "${IPV4_ADDRESS}" | cut -f1 -d/)
# check if the desired IP is already set
- if grep -q "${IPADDR}" "${IFCFG_FILE}"; then
+ if grep -Eq "${IPADDR}(\\b|\\/)" "${IFCFG_FILE}"; then
echo -e " ${INFO} Static IP already configured"
# Otherwise,
else
From ceaf4bc6bcfc1c6ad12dd57773dea2f9947a9a3e Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 23 Apr 2018 20:46:57 +0100
Subject: [PATCH 19/28] Some extra code made it's way into the dev branch. Not
entirely sure how that happened... related to #2115
Signed-off-by: Adam Warner
---
advanced/Scripts/update.sh | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index d2b31948..89e97fdf 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -113,24 +113,6 @@ main() {
echo -e " ${INFO} Pi-hole Core:\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
fi
- if FTLcheckUpdate ; then
- FTL_update=true
- echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}"
- else
- FTL_update=false
- echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
- fi
-
- # Logic: Don't update FTL when there is a core update available
- # since the core update will run the installer which will itself
- # re-install (i.e. update) FTL
- if ${FTL_update} && ! ${core_update}; then
- echo ""
- echo -e " ${INFO} FTL out of date"
- FTLdetect
- echo ""
- fi
-
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
echo -e "\\n ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!
From 43f19034b9a4915c3bce680add731118fa501a56 Mon Sep 17 00:00:00 2001
From: MichaIng <28480705+MichaIng@users.noreply.github.com>
Date: Sat, 28 Apr 2018 15:17:29 +0200
Subject: [PATCH 20/28] "INSTALL_WEB" renamed to "INSTALL_WEB_INTERFACE" #2115
+ Small fix, as due to PR https://github.com/pi-hole/pi-hole/pull/2115 variable "INSTALL_WEB" was renamed into "INSTALL_WEB_INTERFACE".
---
advanced/Scripts/piholeCheckout.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index 589bb76e..71457f9b 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -157,7 +157,7 @@ checkout() {
echo ""
echo -e " ${INFO} Pi-hole Core"
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "development" || { echo " ${CROSS} Unable to pull Core developement branch"; exit 1; }
- if [[ "${INSTALL_WEB}" == "true" ]]; then
+ if [[ "${INSTALL_WEB_INTERFACE}" == "true" ]]; then
echo ""
echo -e " ${INFO} Web interface"
fetch_checkout_pull_branch "${webInterfaceDir}" "devel" || { echo " ${CROSS} Unable to pull Web development branch"; exit 1; }
@@ -173,7 +173,7 @@ checkout() {
echo -e " ${INFO} Shortcut \"master\" detected - checking out master branches..."
echo -e " ${INFO} Pi-hole core"
fetch_checkout_pull_branch "${PI_HOLE_FILES_DIR}" "master" || { echo " ${CROSS} Unable to pull Core master branch"; exit 1; }
- if [[ ${INSTALL_WEB} == "true" ]]; then
+ if [[ ${INSTALL_WEB_INTERFACE} == "true" ]]; then
echo -e " ${INFO} Web interface"
fetch_checkout_pull_branch "${webInterfaceDir}" "master" || { echo " ${CROSS} Unable to pull Web master branch"; exit 1; }
fi
@@ -209,7 +209,7 @@ checkout() {
exit 1
fi
checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${2}"
- elif [[ "${1}" == "web" ]] && [[ "${INSTALL_WEB}" == "true" ]] ; then
+ elif [[ "${1}" == "web" ]] && [[ "${INSTALL_WEB_INTERFACE}" == "true" ]] ; then
str="Fetching branches from ${webInterfaceGitUrl}"
echo -ne " ${INFO} $str"
if ! fully_fetch_repo "${webInterfaceDir}" ; then
From 0c8a32b9ae3fdada94839f065e9816a16b8c09eb Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Sun, 29 Apr 2018 18:27:10 +0100
Subject: [PATCH 21/28] No need to stop services This causes issues on a
`pihole -r reconfigure`
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index e8901193..7a031466 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -2113,23 +2113,6 @@ main() {
welcomeDialogs
# Create directory for Pi-hole storage
mkdir -p /etc/pihole/
-
- #Do we need to stop pihole-FTL or dnsmasq(if coming from an old install)?
- if [[ $(which pihole-FTL 2>/dev/null) ]]; then
- if pihole-FTL --resolver > /dev/null; then
- stop_service pihole-FTL
- else
- stop_service dnsmasq
- fi
- else
- if [[ $(which dnsmasq 2>/dev/null) ]]; then
- stop_service dnsmasq
- fi
- fi
-
- if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
- stop_service lighttpd
- fi
# Determine available interfaces
get_available_interfaces
# Find interfaces and let the user choose one
From 5f2217a0791a1232c7af911e6b2b98ebd341d135 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 30 Apr 2018 21:45:03 +0100
Subject: [PATCH 22/28] Fix for gravity.list not being emptied with an
empty/missing adlist file. Variable output depending on content of /existence
of adlist
Signed-off-by: Adam Warner
---
gravity.sh | 57 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/gravity.sh b/gravity.sh
index 05f4d972..58419029 100755
--- a/gravity.sh
+++ b/gravity.sh
@@ -44,6 +44,8 @@ skipDownload="false"
resolver="pihole-FTL"
+haveSourceUrls=true
+
# Source setupVars from install script
setupVars="${piholeDir}/setupVars.conf"
if [[ -f "${setupVars}" ]];then
@@ -129,18 +131,12 @@ gravity_CheckDNSResolutionAvailable() {
gravity_GetBlocklistUrls() {
echo -e " ${INFO} ${COL_BOLD}Neutrino emissions detected${COL_NC}..."
- # Determine if adlists file needs handling
- if [[ ! -f "${adListFile}" ]]; then
- echo -e " ${CROSS} No adlists file found. Nothing to do!"
- elif [[ -f "${adListDefault}" ]] && [[ -f "${adListFile}" ]]; then
+ if [[ -f "${adListDefault}" ]] && [[ -f "${adListFile}" ]]; then
# Remove superceded $adListDefault file
rm "${adListDefault}" 2> /dev/null || \
echo -e " ${CROSS} Unable to remove ${adListDefault}"
fi
- local str="Pulling blocklist source list into range"
- echo -ne " ${INFO} ${str}..."
-
# Retrieve source URLs from $adListFile
# Logic: Remove comments and empty lines
mapfile -t sources <<< "$(grep -v -E "^(#|$)" "${adListFile}" 2> /dev/null)"
@@ -156,11 +152,15 @@ gravity_GetBlocklistUrls() {
}' <<< "$(printf '%s\n' "${sources[@]}")" 2> /dev/null
)"
+ local str="Pulling blocklist source list into range"
+
if [[ -n "${sources[*]}" ]] && [[ -n "${sourceDomains[*]}" ]]; then
echo -e "${OVER} ${TICK} ${str}"
else
echo -e "${OVER} ${CROSS} ${str}"
- gravity_Cleanup "error"
+ echo -e " ${INFO} No source list found, or it is empty"
+ echo ""
+ haveSourceUrls=false
fi
}
@@ -374,7 +374,9 @@ gravity_ConsolidateDownloadedBlocklists() {
local str lastLine
str="Consolidating blocklists"
- echo -ne " ${INFO} ${str}..."
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -ne " ${INFO} ${str}..."
+ fi
# Empty $matterAndLight if it already exists, otherwise, create it
: > "${piholeDir}/${matterAndLight}"
@@ -393,8 +395,9 @@ gravity_ConsolidateDownloadedBlocklists() {
fi
fi
done
-
- echo -e "${OVER} ${TICK} ${str}"
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -e "${OVER} ${TICK} ${str}"
+ fi
}
# Parse consolidated list into (filtered, unique) domains-only format
@@ -402,24 +405,33 @@ gravity_SortAndFilterConsolidatedList() {
local str num
str="Extracting domains from blocklists"
- echo -ne " ${INFO} ${str}..."
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -ne " ${INFO} ${str}..."
+ fi
# Parse into hosts file
gravity_ParseFileIntoDomains "${piholeDir}/${matterAndLight}" "${piholeDir}/${parsedMatter}"
# Format $parsedMatter line total as currency
num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${parsedMatter}")")
- echo -e "${OVER} ${TICK} ${str}
- ${INFO} Number of domains being pulled in by gravity: ${COL_BLUE}${num}${COL_NC}"
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -e "${OVER} ${TICK} ${str}"
+ fi
+ echo -e " ${INFO} Number of domains being pulled in by gravity: ${COL_BLUE}${num}${COL_NC}"
str="Removing duplicate domains"
- echo -ne " ${INFO} ${str}..."
- sort -u "${piholeDir}/${parsedMatter}" > "${piholeDir}/${preEventHorizon}"
- echo -e "${OVER} ${TICK} ${str}"
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -ne " ${INFO} ${str}..."
+ fi
- # Format $preEventHorizon line total as currency
- num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${preEventHorizon}")")
- echo -e " ${INFO} Number of unique domains trapped in the Event Horizon: ${COL_BLUE}${num}${COL_NC}"
+ sort -u "${piholeDir}/${parsedMatter}" > "${piholeDir}/${preEventHorizon}"
+
+ if [[ "${haveSourceUrls}" == true ]]; then
+ echo -e "${OVER} ${TICK} ${str}"
+ # Format $preEventHorizon line total as currency
+ num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${preEventHorizon}")")
+ echo -e " ${INFO} Number of unique domains trapped in the Event Horizon: ${COL_BLUE}${num}${COL_NC}"
+ fi
}
# Whitelist user-defined domains
@@ -531,7 +543,6 @@ gravity_ParseUserDomains() {
if [[ ! -f "${blacklistFile}" ]]; then
return 0
fi
-
# Copy the file over as /etc/pihole/black.list so dnsmasq can use it
cp "${blacklistFile}" "${blackList}" 2> /dev/null || \
echo -e "\\n ${CROSS} Unable to move ${blacklistFile##*/} to ${piholeDir}"
@@ -618,7 +629,9 @@ if [[ "${skipDownload}" == false ]]; then
# Gravity needs to download blocklists
gravity_CheckDNSResolutionAvailable
gravity_GetBlocklistUrls
- gravity_SetDownloadOptions
+ if [[ "${haveSourceUrls}" == true ]]; then
+ gravity_SetDownloadOptions
+ fi
gravity_ConsolidateDownloadedBlocklists
gravity_SortAndFilterConsolidatedList
else
From 68d7337f98b2ae8fac9b87206251598bef613f4d Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 30 Apr 2018 23:42:41 +0100
Subject: [PATCH 23/28] switch up dnsmasq detection logic
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 39 ++++++++++++++----------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index c0d7f2ed..7fa8bf6e 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1853,23 +1853,20 @@ FTLinstall() {
popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; }
# Install the FTL service
echo -e "${OVER} ${TICK} ${str}"
- # If the --resolver flag returns True (exit code 0), then we can safely stop & disable dnsmasq
- if pihole-FTL --resolver > /dev/null; then
- if which dnsmasq > /dev/null; then
- if check_service_active "dnsmasq";then
- echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
- stop_service dnsmasq
- disable_service dnsmasq
- fi
- fi
-
- #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`
- confdir="conf-dir=/etc/dnsmasq.d"
- conffile="/etc/dnsmasq.conf"
- if ! grep -q "$confdir" "$conffile"; then
- echo "$confdir" >> "$conffile"
- fi
+ # dnsmasq can now be stopped and disabled
+ if check_service_active "dnsmasq";then
+ echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
+ stop_service dnsmasq
+ disable_service dnsmasq
fi
+
+ #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`
+ confdir="conf-dir=/etc/dnsmasq.d"
+ conffile="/etc/dnsmasq.conf"
+ if ! grep -q "$confdir" "$conffile"; then
+ echo "$confdir" >> "$conffile"
+ fi
+
return 0
# Otherwise,
else
@@ -2025,6 +2022,11 @@ FTLdetect() {
echo ""
echo -e " ${INFO} FTL Checks..."
+ # if dnsmasq is running at this point, force reinstall of FTL Binary
+ if check_service_active "dnsmasq";then
+ FTLinstall "${binary}" || return 1
+ fi
+
if FTLcheckUpdate ; then
FTLinstall "${binary}" || return 1
fi
@@ -2197,11 +2199,6 @@ main() {
echo -e " ${INFO} Restarting services..."
# Start services
- # Only start and enable dnsmasq if FTL does not have the --resolver switch
- if ! pihole-FTL --resolver > /dev/null; then
- start_service dnsmasq
- enable_service dnsmasq
- fi
# If the Web server was installed,
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
From e946a35b181fb3fb51f772b0dc14eb2b546630ca Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 30 Apr 2018 23:50:35 +0100
Subject: [PATCH 24/28] Move dnsmasq check into FTLcheckUpdate
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 7fa8bf6e..57878e9a 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1971,6 +1971,11 @@ FTLcheckUpdate()
local remoteSha1
local localSha1
+ # if dnsmasq is running at this point, force reinstall of FTL Binary
+ if check_service_active "dnsmasq";then
+ return 1
+ fi
+
if [[ ! "${ftlBranch}" == "master" ]]; then
if [[ ${ftlLoc} ]]; then
# We already have a pihole-FTL binary downloaded.
@@ -2022,11 +2027,6 @@ FTLdetect() {
echo ""
echo -e " ${INFO} FTL Checks..."
- # if dnsmasq is running at this point, force reinstall of FTL Binary
- if check_service_active "dnsmasq";then
- FTLinstall "${binary}" || return 1
- fi
-
if FTLcheckUpdate ; then
FTLinstall "${binary}" || return 1
fi
From a07891e3e6abfe8059e642ca5807907cbf7f9744 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 30 Apr 2018 23:53:51 +0100
Subject: [PATCH 25/28] 0 is not 1!!
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 57878e9a..e7c5cd55 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1973,7 +1973,7 @@ FTLcheckUpdate()
# if dnsmasq is running at this point, force reinstall of FTL Binary
if check_service_active "dnsmasq";then
- return 1
+ return 0
fi
if [[ ! "${ftlBranch}" == "master" ]]; then
From a6e4b0fea567d83e9667b12f1a96a1d3c0ed0493 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 1 May 2018 21:59:12 +0100
Subject: [PATCH 26/28] - Test for existence of remote non-master branch of FTL
before attemtping to check for update - Move some functions from checkout to
basic-install - provide helpful error message on downlaod not existing
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeCheckout.sh | 88 ++---------------------------
advanced/Scripts/update.sh | 11 +++-
automated install/basic-install.sh | 89 ++++++++++++++++++++++++++++++
3 files changed, 104 insertions(+), 84 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index 71457f9b..65bb5b7a 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -17,92 +17,14 @@ source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
# piholeGitURL set in basic-install.sh
# is_repo() sourced from basic-install.sh
# setupVars set in basic-install.sh
+# check_download_exists sourced from basic-install.sh
+# fully_fetch_repo sourced from basic-install.sh
+# get_available_branches sourced from basic-install.sh
+# fetch_checkout_pull_branch sourced from basic-install.sh
+# checkout_pull_branch sourced from basic-install.sh
source "${setupVars}"
-coltable="/opt/pihole/COL_TABLE"
-source ${coltable}
-
-check_download_exists() {
- status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
- if grep -q "404" <<< "$status"; then
- return 1
- else
- return 0
- fi
-}
-
-fully_fetch_repo() {
- # Add upstream branches to shallow clone
- local directory="${1}"
-
- cd "${directory}" || return 1
- if is_repo "${directory}"; then
- git remote set-branches origin '*' || return 1
- git fetch --quiet || return 1
- else
- return 1
- fi
- return 0
-}
-
-get_available_branches() {
- # Return available branches
- local directory
- directory="${1}"
- local output
-
- cd "${directory}" || return 1
- # Get reachable remote branches, but store STDERR as STDOUT variable
- output=$( { git remote show origin | grep 'tracked' | sed 's/tracked//;s/ //g'; } 2>&1 )
- echo "$output"
- return
-}
-
-fetch_checkout_pull_branch() {
- # Check out specified branch
- local directory
- directory="${1}"
- local branch
- branch="${2}"
-
- # Set the reference for the requested branch, fetch, check it put and pull it
- cd "${directory}" || return 1
- git remote set-branches origin "${branch}" || return 1
- git stash --all --quiet &> /dev/null || true
- git clean --quiet --force -d || true
- git fetch --quiet || return 1
- checkout_pull_branch "${directory}" "${branch}" || return 1
-}
-
-checkout_pull_branch() {
- # Check out specified branch
- local directory
- directory="${1}"
- local branch
- branch="${2}"
- local oldbranch
-
- cd "${directory}" || return 1
-
- oldbranch="$(git symbolic-ref HEAD)"
-
- str="Switching to branch: '${branch}' from '${oldbranch}'"
- echo -ne " ${INFO} $str"
- git checkout "${branch}" --quiet || return 1
- echo -e "${OVER} ${TICK} $str"
-
- git_pull=$(git pull || return 1)
-
- if [[ "$git_pull" == *"up-to-date"* ]]; then
- echo -e " ${INFO} ${git_pull}"
- else
- echo -e "$git_pull\\n"
- fi
-
- return 0
-}
-
warning1() {
echo " Please note that changing branches severely alters your Pi-hole subsystems"
echo " Features that work on the master branch, may not on a development branch"
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index 89e97fdf..2279d9c7 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -133,8 +133,17 @@ main() {
FTL_update=true
echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}"
else
+ case $? in
+ 1)
+ echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
+ ;;
+ 2)
+ echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_LIGHT_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
+ ;;
+ *)
+ echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Something has gone wrong, contact support${COL_NC}"
+ esac
FTL_update=false
- echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
fi
if [[ "${core_update}" == false && "${web_update}" == false && "${FTL_update}" == false ]]; then
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index e7c5cd55..4059ea1d 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1762,6 +1762,86 @@ update_dialogs() {
esac
}
+check_download_exists() {
+ status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
+ if grep -q "404" <<< "$status"; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+fully_fetch_repo() {
+ # Add upstream branches to shallow clone
+ local directory="${1}"
+
+ cd "${directory}" || return 1
+ if is_repo "${directory}"; then
+ git remote set-branches origin '*' || return 1
+ git fetch --quiet || return 1
+ else
+ return 1
+ fi
+ return 0
+}
+
+get_available_branches() {
+ # Return available branches
+ local directory
+ directory="${1}"
+ local output
+
+ cd "${directory}" || return 1
+ # Get reachable remote branches, but store STDERR as STDOUT variable
+ output=$( { git remote show origin | grep 'tracked' | sed 's/tracked//;s/ //g'; } 2>&1 )
+ echo "$output"
+ return
+}
+
+fetch_checkout_pull_branch() {
+ # Check out specified branch
+ local directory
+ directory="${1}"
+ local branch
+ branch="${2}"
+
+ # Set the reference for the requested branch, fetch, check it put and pull it
+ cd "${directory}" || return 1
+ git remote set-branches origin "${branch}" || return 1
+ git stash --all --quiet &> /dev/null || true
+ git clean --quiet --force -d || true
+ git fetch --quiet || return 1
+ checkout_pull_branch "${directory}" "${branch}" || return 1
+}
+
+checkout_pull_branch() {
+ # Check out specified branch
+ local directory
+ directory="${1}"
+ local branch
+ branch="${2}"
+ local oldbranch
+
+ cd "${directory}" || return 1
+
+ oldbranch="$(git symbolic-ref HEAD)"
+
+ str="Switching to branch: '${branch}' from '${oldbranch}'"
+ echo -ne " ${INFO} $str"
+ git checkout "${branch}" --quiet || return 1
+ echo -e "${OVER} ${TICK} $str"
+
+ git_pull=$(git pull || return 1)
+
+ if [[ "$git_pull" == *"up-to-date"* ]]; then
+ echo -e " ${INFO} ${git_pull}"
+ else
+ echo -e "$git_pull\\n"
+ fi
+
+ return 0
+}
+
clone_or_update_repos() {
# If the user wants to reconfigure,
if [[ "${reconfigure}" == true ]]; then
@@ -1977,6 +2057,15 @@ FTLcheckUpdate()
fi
if [[ ! "${ftlBranch}" == "master" ]]; then
+ #Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
+ local path
+ path="${ftlBranch}/${binary}"
+ # shellcheck disable=SC1090
+ if ! check_download_exists "$path"; then
+ echo -e " ${INFO} Branch \"${ftlBranch}\" is not available.\\n ${INFO} Use ${COL_LIGHT_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
+ return 2
+ fi
+
if [[ ${ftlLoc} ]]; then
# We already have a pihole-FTL binary downloaded.
# Alt branches don't have a tagged version against them, so just confirm the checksum of the local vs remote to decide whether we download or not
From 76654c7856b00a25ace1dd31019f78337d59f5a0 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Thu, 3 May 2018 21:16:31 +0100
Subject: [PATCH 27/28] Actually check for dnsmasq's existence before
attempting to interact with it's service
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 4059ea1d..3100ce58 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1933,11 +1933,13 @@ FTLinstall() {
popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; }
# Install the FTL service
echo -e "${OVER} ${TICK} ${str}"
- # dnsmasq can now be stopped and disabled
- if check_service_active "dnsmasq";then
- echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
- stop_service dnsmasq
- disable_service dnsmasq
+ # dnsmasq can now be stopped and disabled if it exists
+ if which dnsmasq > /dev/null; then
+ if check_service_active "dnsmasq";then
+ echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
+ stop_service dnsmasq
+ disable_service dnsmasq
+ fi
fi
#ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`
@@ -2051,9 +2053,11 @@ FTLcheckUpdate()
local remoteSha1
local localSha1
- # if dnsmasq is running at this point, force reinstall of FTL Binary
- if check_service_active "dnsmasq";then
- return 0
+ # if dnsmasq exists and is running at this point, force reinstall of FTL Binary
+ if which dnsmasq > /dev/null; then
+ if check_service_active "dnsmasq";then
+ return 0
+ fi
fi
if [[ ! "${ftlBranch}" == "master" ]]; then
From 2ef76d5e3152c4b35e639c3659c74befc68bc7ed Mon Sep 17 00:00:00 2001
From: DL6ER
Date: Fri, 4 May 2018 22:19:39 +0200
Subject: [PATCH 28/28] Remove LOCAL_DNS_PORT support
Signed-off-by: DL6ER
---
advanced/Scripts/webpage.sh | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index 21623eea..8a85839f 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -149,9 +149,13 @@ ProcessDNSSettings() {
let COUNTER=COUNTER+1
done
- if [ ! -z "${LOCAL_DNS_PORT}" ]; then
- add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_DNS_PORT}"
- fi
+ # The option LOCAL_DNS_PORT is deprecated
+ # We apply it once more, and then convert it into the current format
+ if [ ! -z "${LOCAL_DNS_PORT}" ]; then
+ add_dnsmasq_setting "server" "127.0.0.1#${LOCAL_DNS_PORT}"
+ add_setting "PIHOLE_DNS_${COUNTER}" "127.0.0.1#${LOCAL_DNS_PORT}"
+ delete_setting "LOCAL_DNS_PORT"
+ fi
delete_dnsmasq_setting "domain-needed"
@@ -529,16 +533,6 @@ SetPrivacyLevel() {
changeFTLsetting "PRIVACYLEVEL" "${args[2]}"
fi
}
-SetLocalDNSport() {
- # Ensure port is a natural number { 0, 1, 2, 3, ... }
- if [[ "${1}" == "0" ]]; then
- delete_setting "LOCAL_DNS_PORT"
- ProcessDNSSettings
- elif [[ "${1}" =~ ^[0-9]+$ ]]; then
- change_setting "LOCAL_DNS_PORT" "${1}"
- ProcessDNSSettings
- fi
-}
main() {
args=("$@")
@@ -570,7 +564,6 @@ main() {
"adlist" ) CustomizeAdLists;;
"audit" ) audit;;
"-l" | "privacylevel" ) SetPrivacyLevel;;
- "localdnsport" ) SetLocalDNSport "$3";;
* ) helpFunc;;
esac