-## The multi-platform, network-wide ad blocker
+## Pi-hole®: The multi-platform, network-wide ad blocker
-Block ads for **all** your devices _without_ the need to install client-side software. The Pi-hole™ blocks ads at the DNS-level, so all your devices are protected.
+Block ads for **all** your devices _without_ the need to install client-side software. The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
- Web Browsers
- Cell Phones
@@ -53,9 +53,9 @@ wget -O basic-install.sh https://install.pi-hole.net
bash basic-install.sh
```
-Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use Pi-hole™ as their DNS server.
+Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use Pi-hole as their DNS server.
-## What is Pi-hole™ and how do I install it?
+## What is Pi-hole and how do I install it?
@@ -73,7 +73,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei
## Technical Details
-The Pi-hole™ is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
+The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
### Gravity
@@ -102,7 +102,7 @@ Domains can be whitelisted and blacklisted using either the web interface or the
### Settings
-The settings page lets you control and configure your Pi-hole™. You can do things like:
+The settings page lets you control and configure your Pi-hole. You can do things like:
- enable Pi-hole's built-in DHCP server
- exclude domains from the graphs
@@ -113,7 +113,7 @@ The settings page lets you control and configure your Pi-hole™. You can do th
#### Built-in DHCP Server
-Pi-hole™ ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole™ as their DNS server if your router does not let you adjust the DHCP options.
+Pi-hole ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options.
@@ -137,7 +137,7 @@ The same output can be achieved on the CLI by running `chronometer.sh -j`
You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). 
-## Pi-hole™ Projects
+## Pi-hole Projects
- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
- [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py)
From 38d213ee6cdb02cc8667c4dd5c1f3a3cd6db7f24 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Tue, 11 Jul 2017 22:55:50 -0500
Subject: [PATCH 065/116] add section about additional ways to support us
Signed-off-by: Jacob Salmela
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index b2f3908f..a1d69a78 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,9 @@ Digital Ocean helps with our infrastructure, but our developers are all voluntee
-  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
-  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
+### Other Ways To Support Us
+If you're not the type to give away money, there are [other ways support us](https://pi-hole.net/donate): you can sign up for services through our affiliate links, which will also help us offset some of the costs associated with keeping Pi-hole operational.
+
### One-Step Automated Install
1. Install a [supported operating system](https://discourse.pi-hole.net/t/hardware-software-requirements/273/1)
2. Run the command below (it downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
From 527fe2f5e176e0c185f01996d38e6568c97f7b2d Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Tue, 11 Jul 2017 23:06:42 -0500
Subject: [PATCH 066/116] wordsmithing using Pi-hole as your DNS server,
gravity, and additional blocklists.
Signed-off-by: Jacob Salmela
---
README.md | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index a1d69a78..d4744972 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,11 @@ wget -O basic-install.sh https://install.pi-hole.net
bash basic-install.sh
```
-Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use Pi-hole as their DNS server.
+Once installed, [configure your router to have **DHCP clients use the Pi-hole as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) and then any device that connects to your network will have ads blocked without any further configuration.
+
+If your router does not support setting the DNS server, you can [use Pi-hole's built in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026); just be sure to disable DHCP on your router first.
+
+Alternatively, you can manually set each device to use Pi-hole as their DNS server.
## What is Pi-hole and how do I install it?
@@ -68,6 +72,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei
- [Users Forum](https://discourse.pi-hole.net/)
- [FAQs](https://discourse.pi-hole.net/c/faqs)
+- [Feature requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
- [Wiki](https://github.com/pi-hole/pi-hole/wiki)
-  [Tweet @The_Pi_Hole](https://twitter.com/The_Pi_Hole)
-  [Reddit /r/pihole](https://www.reddit.com/r/pihole/)
@@ -78,9 +83,12 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei
The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
-### Gravity
+### Gravity: Finding Ads To Block
-The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 1.6 million entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0) (if you decide to use the [mahakala list](https://github.com/pi-hole/pi-hole/commit/963eacfe0537a7abddf30441c754c67ca1e40965)). This script is controlled by the `pihole` command. Please run `pihole -h` to see what commands can be run via `pihole`.
+The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) script does most of the magic. The script pulls in over 100,000 known ad-serving domains from many sources and aggregates them into a single list.
+
+#### Additional Blocklists
+You can also use Pi-hole to block additional domains beyond the defaults. It can even be used to block malware or phising domains. [The Big Blocklist Collection](https://wally3k.github.io/) is a good resource for finding additional domains to block.
From e5e26413e98c106eee52fcca4134e280b03bb39c Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Tue, 11 Jul 2017 23:28:47 -0500
Subject: [PATCH 067/116] new executive summary above the fold
Signed-off-by: Jacob Salmela
---
README.md | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index d4744972..7782dc54 100644
--- a/README.md
+++ b/README.md
@@ -10,18 +10,26 @@
## Pi-hole®: The multi-platform, network-wide ad blocker
-Block ads for **all** your devices _without_ the need to install client-side software. The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
-
-- Web Browsers
-- Cell Phones
-- Smart TV's
-- Internet-connected home automation
-- Anything that communicates with the Internet
+Block ads for **all** your devices _without_ the need to install client-side software.
+## Executive Summary
+The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
+
+- **Easy-to-install** - our intelligent installer walks you through the process with no additional software needed on client devices
+- **Universal** - ads are blocked in _non-browser locations_ such as ad-supported mobile apps and smart TVs
+- **Quick** - installation takes less than ten minutes and it [_really_ is _that easy_](https://discourse.pi-hole.net/t/new-pi-hole-questions/3971/5?u=jacob.salmela)
+- **Informative** - an administrative Web interface shows ad-blocking statistics
+- **Lightweight** - designed to run on [minimal resources](https://discourse.pi-hole.net/t/hardware-software-requirements/273)
+- **Scalable** - even in large environments, [Pi-hole can handle hundreds of millions of queries](https://pi-hole.net/2017/05/24/how-much-traffic-can-pi-hole-handle/) (with the right hardware specs)
+- **Powerful** - advertisements are blocked over IPv4 _and_ IPv6
+- **Fast** - it speeds up high-cost, high-latency networks by caching DNS queries and saves bandwidth by not downloading advertisement elements
+- **Versatile** - Pi-hole can function also function as a DHCP server
+
+
## Your Support Still Matters
Digital Ocean helps with our infrastructure, but our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
From fbd55dd74058a385edd881133672469b99dbc811 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Tue, 11 Jul 2017 23:33:49 -0500
Subject: [PATCH 068/116] tweaks to donation verbiage
Signed-off-by: Jacob Salmela
---
README.md | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 7782dc54..5199e534 100644
--- a/README.md
+++ b/README.md
@@ -29,27 +29,26 @@ The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
- **Fast** - it speeds up high-cost, high-latency networks by caching DNS queries and saves bandwidth by not downloading advertisement elements
- **Versatile** - Pi-hole can function also function as a DHCP server
+# Pi-hole Is Free, But Powered By Your Donations
-## Your Support Still Matters
-
-Digital Ocean helps with our infrastructure, but our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
+[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*.
-  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
-  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
-### Other Ways To Support Us
-If you're not the type to give away money, there are [other ways support us](https://pi-hole.net/donate): you can sign up for services through our affiliate links, which will also help us offset some of the costs associated with keeping Pi-hole operational.
+## Other Ways To Support Us
+If you'd rather not send money, there are [other ways to support us](https://pi-hole.net/donate): you can sign up for services through our affiliate links, which will also help us offset some of the costs associated with keeping Pi-hole operational.
-### One-Step Automated Install
+# One-Step Automated Install
1. Install a [supported operating system](https://discourse.pi-hole.net/t/hardware-software-requirements/273/1)
2. Run the command below (it downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
-### `curl -sSL https://install.pi-hole.net | bash`
+#### `curl -sSL https://install.pi-hole.net | bash`
-#### Alternative Semi-Automated Install Methods
+## Alternative Semi-Automated Install Methods
_If you wish to read over the script before running it, run `nano basic-install.sh` to open the file in a text viewer._
-##### Clone our repository and run the automated installer from your device.
+### Clone our repository and run the automated installer from your device.
```
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
@@ -70,7 +69,7 @@ If your router does not support setting the DNS server, you can [use Pi-hole's b
Alternatively, you can manually set each device to use Pi-hole as their DNS server.
-## What is Pi-hole and how do I install it?
+# What is Pi-hole and how do I install it?
From 9348a8ab15f5dcd0c1b7d927ee70cbcbdb77d7bd Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Tue, 11 Jul 2017 23:36:40 -0500
Subject: [PATCH 069/116] move technical details to the bottom of the page in
light of showing off Pi-holes features first.
Signed-off-by: Jacob Salmela
---
README.md | 60 ++++++++++++++++++++++++++++---------------------------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/README.md b/README.md
index 5199e534..7a4c58dd 100644
--- a/README.md
+++ b/README.md
@@ -74,36 +74,9 @@ Alternatively, you can manually set each device to use Pi-hole as their DNS serv
+# Overview Of Features
-## Get Help Or Connect With Us On The Web
-
-- [Users Forum](https://discourse.pi-hole.net/)
-- [FAQs](https://discourse.pi-hole.net/c/faqs)
-- [Feature requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
-- [Wiki](https://github.com/pi-hole/pi-hole/wiki)
--  [Tweet @The_Pi_Hole](https://twitter.com/The_Pi_Hole)
--  [Reddit /r/pihole](https://www.reddit.com/r/pihole/)
--  [Pi-hole channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
-- [](https://gitter.im/pi-hole/pi-hole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-## Technical Details
-
-The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
-
-### Gravity: Finding Ads To Block
-
-The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) script does most of the magic. The script pulls in over 100,000 known ad-serving domains from many sources and aggregates them into a single list.
-
-#### Additional Blocklists
-You can also use Pi-hole to block additional domains beyond the defaults. It can even be used to block malware or phising domains. [The Big Blocklist Collection](https://wally3k.github.io/) is a good resource for finding additional domains to block.
-
-
-
-#### Other Operating Systems
-
-The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a web server, it should work OK. If there are other platforms you'd like supported, let us know.
-
-### Web Interface
+## The Dashboard (Web Interface)
The [Web interface](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
@@ -155,6 +128,35 @@ The same output can be achieved on the CLI by running `chronometer.sh -j`
You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). 
+## Get Help Or Connect With Us On The Web
+
+- [Users Forum](https://discourse.pi-hole.net/)
+- [FAQs](https://discourse.pi-hole.net/c/faqs)
+- [Feature requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
+- [Wiki](https://github.com/pi-hole/pi-hole/wiki)
+-  [Tweet @The_Pi_Hole](https://twitter.com/The_Pi_Hole)
+-  [Reddit /r/pihole](https://www.reddit.com/r/pihole/)
+-  [Pi-hole channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
+- [](https://gitter.im/pi-hole/pi-hole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+## Technical Details
+
+The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
+
+### Gravity: Finding Ads To Block
+
+The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) script does most of the magic. The script pulls in over 100,000 known ad-serving domains from many sources and aggregates them into a single list.
+
+#### Additional Blocklists
+You can also use Pi-hole to block additional domains beyond the defaults. It can even be used to block malware or phising domains. [The Big Blocklist Collection](https://wally3k.github.io/) is a good resource for finding additional domains to block.
+
+
+
+#### Other Operating Systems
+
+The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a web server, it should work OK. If there are other platforms you'd like supported, let us know.
+
+
## Pi-hole Projects
- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
From 24df5f5208b1b55e94406ff8d3fac2af65e07acf Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 12 Jul 2017 00:36:12 -0500
Subject: [PATCH 070/116] describe settings page in the order they appear on
the dashboard--also add screenshots
Signed-off-by: Jacob Salmela
---
README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 86 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 7a4c58dd..6b14b40b 100644
--- a/README.md
+++ b/README.md
@@ -78,31 +78,108 @@ Alternatively, you can manually set each device to use Pi-hole as their DNS serv
## The Dashboard (Web Interface)
-The [Web interface](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
+The [dashboard](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) will (by default) be enabled during installation so you can view stats, change settings, and configure your Pi-hole.
-`http://192.168.1.x/admin/index.php` or `http://pi.hole/admin`
+
-
+There are several ways to [access the dashboard](https://discourse.pi-hole.net/t/how-do-i-access-pi-holes-dashboard-admin-interface/3168):
-### Whitelist and blacklist
+1. `http:///admin/`
+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 Query Log
+
+If enabled, the query log will show all of the DNS queries requested by clients using Pi-hole as their DNS server. Forwarded domains will show in green, and blocked (_Pi-holed_) domains will show in red. You can also white or black list domains from within this section.
-Domains can be whitelisted and blacklisted using either the web interface or the command line. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details
-
+
+#### Long-term Statistics
+Using our Faster-Than-Light Engine ([FTL](https://github.com/pi-hole/FTL)), Pi-hole can store all of the domains queried in a database for retrieval or analysis later on. You can view this data as a graph, individual queries, or top clients/advertisers.
+
+
+
+
+
+### Whitelist And Blacklist
+
+Domains can be [whitelisted](https://discourse.pi-hole.net/t/commonly-whitelisted-domains/212) and/or [blacklisted](https://discourse.pi-hole.net/t/commonly-blacklisted-domains/305) using either the dashboard or [the `pihole` command](https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738).
+
+
+
+
+
+#### Additional Blocklists
+By default, Pi-hole blocks over 100,000 known ad-serving domains. You can expand the blocking power of your Pi-hole by [adding additional lists](https://discourse.pi-hole.net/t/how-do-i-add-additional-block-lists-to-pi-hole/259) such as the ones found on [The Big Blocklist Collection](https://wally3k.github.io/).
+
+
+
+
+
+### Enable And Disable Pi-hole
+Sometimes you may want to stop using Pi-hole or turn it back on. You can trigger this via the dashboard or command line.
+
+
+
+
+
+### Tools
+
+
+
+
+
+
+#### Update Ad Lists
+This runs `gravity` to download any newly-added domains from your source lists.
+
+#### Query Ad Lists
+You can find out what list a certain domain was on. This is useful for troubleshooting sites that may not work properly due to a blocked domain.
+
+#### `tail`ing Log Files
+You can watch the log files in real time to help debug any issues, or just see what's happening with your Pi-hole.
+
+#### Pi-hole Debugger
+If you are having trouble with your Pi-hole, this is the place to go. You can run the debugger and it will attempt to diagnose any issues and then link to an FAQ with instructions on rectifying the problem.
+
+
+
+
+
+If run [via the command line](https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#debug), you will see red/yellow/green text, which makes it easy to identify any problems.
+
+
+
+
+
+
+After the debugger has finished, you have the option to upload it to our secure server for 48 hours. All you need to do then is provide one of our developers the unique token generated by the debugger (this is usually done via [our forums](https://discourse.pi-hole.net/c/bugs-problems-issues)).
+
+
+
+
+
+However, most of the time, you will be able to solve any issues without any intervention from us. But if you can't, we're always around to help out.
+
### Settings
The settings page lets you control and configure your Pi-hole. You can do things like:
+- view networking information
+- flush logs or disable the logging of queries
- enable Pi-hole's built-in DHCP server
-- exclude domains from the graphs
+- manage block lists
+- exclude domains from the graphs and enable privacy options
- configure upstream DNS servers
+- restart Pi-hole's services
+- back up some of Pi-hole's important files
- and more!
-
+
-#### Built-in DHCP Server
+## Built-in DHCP Server
Pi-hole ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options.
@@ -147,11 +224,6 @@ The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queri
The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) script does most of the magic. The script pulls in over 100,000 known ad-serving domains from many sources and aggregates them into a single list.
-#### Additional Blocklists
-You can also use Pi-hole to block additional domains beyond the defaults. It can even be used to block malware or phising domains. [The Big Blocklist Collection](https://wally3k.github.io/) is a good resource for finding additional domains to block.
-
-
-
#### Other Operating Systems
The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a web server, it should work OK. If there are other platforms you'd like supported, let us know.
From 03387391def4e473faf670e85f67752e617627aa Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 12 Jul 2017 00:53:14 -0500
Subject: [PATCH 071/116] wordsmith DHCP server section, API section, and
chronometer2 section. Also add more images
Signed-off-by: Jacob Salmela
---
README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 6b14b40b..36fc5312 100644
--- a/README.md
+++ b/README.md
@@ -181,31 +181,69 @@ The settings page lets you control and configure your Pi-hole. You can do thing
## Built-in DHCP Server
-Pi-hole ships with a built-in DHCP server. This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options.
+Pi-hole ships with a [built-in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026). This allows you to let your network devices use Pi-hole as their DNS server if your router does not let you adjust the DHCP options.
+
+One nice feature of using Pi-hole's DHCP server if you can set hostnames and DHCP reservations so you'll [see hostnames in the query log instead of IP addresses](https://discourse.pi-hole.net/t/how-do-i-show-hostnames-instead-of-ip-addresses-in-the-dashboard/3530). You can still do this without using Pi-hole's DHCP server; it just takes a little more work. If you do plan to use Pi-hole's DHCP server, be sure to disable DHCP on your router first.
+
-
+
-## API
-
-A basic read-only API can be accessed at `/admin/api.php`. It returns the following JSON:
+## The FTL Engine: Our API
+A read-only API can be accessed at `admin/api.php`. It returns the following JSON:
``` json
{
- "domains_being_blocked": "136708",
- "dns_queries_today": "18108",
- "ads_blocked_today": "14648",
- "ads_percentage_today": "80.89"
-}
+ "domains_being_blocked":111175,
+ "dns_queries_today":15669,
+ "ads_blocked_today":1752,
+ "ads_percentage_today":11.181314,
+ "unique_domains":1178,
+ "queries_forwarded":9177,
+ "queries_cached":4740,
+ "unique_clients":18
+ }
```
+More details on the API can be found [here](https://discourse.pi-hole.net/t/pi-hole-api/1863) and on [the repo itself](https://github.com/pi-hole/FTL).
The same output can be achieved on the CLI by running `chronometer.sh -j`
-## Real-time Statistics
+### Real-time Statistics, Courtesy Of The Time Cops
-You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an [2.8" LCD screen](http://amzn.to/1P0q1Fj). This is accomplished via [`chronometer.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh). 
+Using [chronometer2](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/chronometer.sh), you can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-pi-holes-stats-over-ssh-or-on-an-lcd-using-chronometer/240) via `ssh` or on an LCD screen such as the [2.8" LCD screen from Adafruit](http://amzn.to/1P0q1Fj).
-## Get Help Or Connect With Us On The Web
+Simply run `pihole -c` for some detailed information.
+```
+|¯¯¯(¯)__|¯|_ ___|¯|___ Pi-hole: v3.2
+| ¯_/¯|__| ' \/ _ \ / -_) AdminLTE: v3.2
+|_| |_| |_||_\___/_\___| FTL: v2.10
+ ——————————————————————————————————————————————————————————
+ Hostname: pihole (Raspberry Pi 1, Model B)
+ Uptime: 11 days, 12:55:01
+ Task Load: 0.35 0.16 0.15 (Active: 5 of 33 tasks)
+ CPU usage: 48% (1 core @ 700 MHz, 47c)
+ RAM usage: 12% (Used: 54 MB of 434 MB)
+ HDD usage: 20% (Used: 1 GB of 7 GB)
+ LAN addr: 192.168.1.100 (Gateway: 192.168.1.1)
+ Pi-hole: Active (Blocking: 111175 sites)
+ Ads Today: 11% (1759 of 15812 queries)
+ Fwd DNS: 208.67.222.222 (Alt DNS: 3 others)
+ ——————————————————————————————————————————————————————————
+ Recently blocked: www.google-analytics.com
+ Top Advertiser: www.example.org
+ Top Domain: www.example.org
+ Top Client: somehost
+```
+
+
+
+
+
+
+
+
+
+# Get Help Or Connect With Us On The Web
- [Users Forum](https://discourse.pi-hole.net/)
- [FAQs](https://discourse.pi-hole.net/c/faqs)
From f4c7d389e5926903c90652d3adc3654fc1f1ef71 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 12 Jul 2017 01:03:09 -0500
Subject: [PATCH 072/116] more wordsmithing and updating links
Signed-off-by: Jacob Salmela
---
README.md | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 36fc5312..2c95e0b3 100644
--- a/README.md
+++ b/README.md
@@ -169,15 +169,18 @@ The settings page lets you control and configure your Pi-hole. You can do thing
- view networking information
- flush logs or disable the logging of queries
-- enable Pi-hole's built-in DHCP server
-- manage block lists
+- [enable Pi-hole's built-in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026)
+- [manage block lists](https://discourse.pi-hole.net/t/how-do-i-add-additional-block-lists-to-pi-hole/259)
- exclude domains from the graphs and enable privacy options
- configure upstream DNS servers
- restart Pi-hole's services
- back up some of Pi-hole's important files
- and more!
-
+
+
+
+
## Built-in DHCP Server
@@ -191,7 +194,9 @@ One nice feature of using Pi-hole's DHCP server if you can set hostnames and DHC
## The FTL Engine: Our API
-A read-only API can be accessed at `admin/api.php`. It returns the following JSON:
+A read-only API can be accessed at `admin/api.php` (the same output can be achieved on the CLI by running `pihole -c -j`).
+
+It returns the following JSON:
``` json
{
"domains_being_blocked":111175,
@@ -204,9 +209,8 @@ A read-only API can be accessed at `admin/api.php`. It returns the following JSO
"unique_clients":18
}
```
-More details on the API can be found [here](https://discourse.pi-hole.net/t/pi-hole-api/1863) and on [the repo itself](https://github.com/pi-hole/FTL).
-The same output can be achieved on the CLI by running `chronometer.sh -j`
+More details on the API can be found [here](https://discourse.pi-hole.net/t/pi-hole-api/1863) and on [the repo itself](https://github.com/pi-hole/FTL).
### Real-time Statistics, Courtesy Of The Time Cops
@@ -254,20 +258,12 @@ Simply run `pihole -c` for some detailed information.
-  [Pi-hole channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
- [](https://gitter.im/pi-hole/pi-hole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-## Technical Details
+# Technical Details
-The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queried, a small Web page or GIF is delivered in place of the advertisement.
-
-### Gravity: Finding Ads To Block
-
-The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) script does most of the magic. The script pulls in over 100,000 known ad-serving domains from many sources and aggregates them into a single list.
-
-#### Other Operating Systems
-
-The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a web server, it should work OK. If there are other platforms you'd like supported, let us know.
+To summarize into a short sentence, the Pi-hole is an **advertising-aware DNS/Web server**. And while quite outdated at this point, [this original blog post about Pi-hole](https://jacobsalmela.com/2015/06/16/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/) goes into **great detail** about how it was setup and how it works. Syntactically, it's no longer accurate, but the same basic principles and logic still apply to Pi-hole's current state.
-## Pi-hole Projects
+# Pi-hole Projects
- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
- [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py)
@@ -288,7 +284,7 @@ The automated install is only for a clean install of a Debian family or Fedora b
- [Pi-hole Droid - open source 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)
-## Coverage
+# Coverage
- [Adafruit livestream install](https://www.youtube.com/watch?v=eg4u2j1HYlI)
- [TekThing: 5 fun, easy projects for a Raspberry Pi](https://youtu.be/QwrKlyC2kdM?t=1m42s)
From bc1065a7fc83c2b0a4e93b50e7c1a1eb264f8454 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 12 Jul 2017 01:18:50 -0500
Subject: [PATCH 073/116] reorganize sections. install instructions first. also
added more wordsmithing and links to interesting pi-hole.net articles
Signed-off-by: Jacob Salmela
---
README.md | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 2c95e0b3..980a9d93 100644
--- a/README.md
+++ b/README.md
@@ -29,16 +29,6 @@ The Pi-hole blocks ads at the DNS-level, so all your devices are protected.
- **Fast** - it speeds up high-cost, high-latency networks by caching DNS queries and saves bandwidth by not downloading advertisement elements
- **Versatile** - Pi-hole can function also function as a DHCP server
-# 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*.
-
--  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
--  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
-
-## Other Ways To Support Us
-If you'd rather not send money, there are [other ways to support us](https://pi-hole.net/donate): you can sign up for services through our affiliate links, which will also help us offset some of the costs associated with keeping Pi-hole operational.
-
# One-Step Automated Install
1. Install a [supported operating system](https://discourse.pi-hole.net/t/hardware-software-requirements/273/1)
2. Run the command below (it downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
@@ -74,6 +64,29 @@ Alternatively, you can manually set each device to use Pi-hole as their DNS serv
+# 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*.
+
+-  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
+-  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
+
+## Other Ways To Support Us
+### Affiliate Links
+If you'd rather not send money, there are [other ways to support us](https://pi-hole.net/donate): you can sign up for services through our affiliate links, which will also help us offset some of the costs associated with keeping Pi-hole operational; or you can support us in some non-tangible ways as listed below.
+
+### Contributing Code Via Pull Requests
+
+We don't work on Pi-hole for monetary reasons; we work on it because we think it's fun and we think our software is important in today's world. To that end, we welcome all contributors--from novices to masters.
+
+If you feel you have some code to contribute, we're happy to take a look. Just make sure to fill out our template when submitting a pull request. We're all volunteers on the project and without all the information in the template, it's very difficult for us to quickly get the code merged in.
+
+You'll find that the [install script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) and the [debug script](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/piholeDebug.sh) have an abundance of comments. These are two important scripts but we think they can also be a valuable resource to those who want to learn how to write scripts or code a program, which is why they are fully commented. So we encourage anyone who likes to tinker to read through it and submit a PR for us to review.
+
+### Presenting About Pi-hole
+
+Word-of-mouth has immensely helped our project grow. If you are going to be presenting about Pi-hole at a conference, meetup, or even for a school project, [get a hold of us for some free swag](https://pi-hole.net/2017/05/17/giving-a-presentation-on-pi-hole-contact-us-first-for-some-goodies-and-support/) to hand out to your audience.
+
# Overview Of Features
## The Dashboard (Web Interface)
@@ -96,6 +109,8 @@ If enabled, the query log will show all of the DNS queries requested by clients
+The query log and graphs are what have helped people [discover what sort of traffic is traversing their networks](https://pi-hole.net/2017/07/06/round-3-what-really-happens-on-your-network/).
+
#### Long-term Statistics
Using our Faster-Than-Light Engine ([FTL](https://github.com/pi-hole/FTL)), Pi-hole can store all of the domains queried in a database for retrieval or analysis later on. You can view this data as a graph, individual queries, or top clients/advertisers.
@@ -139,7 +154,7 @@ This runs `gravity` to download any newly-added domains from your source lists.
You can find out what list a certain domain was on. This is useful for troubleshooting sites that may not work properly due to a blocked domain.
#### `tail`ing Log Files
-You can watch the log files in real time to help debug any issues, or just see what's happening with your Pi-hole.
+You can [watch the log files](https://discourse.pi-hole.net/t/how-do-i-watch-and-interpret-the-pihole-log-file/276) in real time to help debug any issues, or just see what's happening with your Pi-hole.
#### Pi-hole Debugger
If you are having trouble with your Pi-hole, this is the place to go. You can run the debugger and it will attempt to diagnose any issues and then link to an FAQ with instructions on rectifying the problem.
From ea8927e1da9ab21a0b2fcadcee0d11151be186b3 Mon Sep 17 00:00:00 2001
From: Jacob Salmela
Date: Wed, 12 Jul 2017 01:21:47 -0500
Subject: [PATCH 074/116] add facebook page to contact info
Signed-off-by: Jacob Salmela
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 980a9d93..0ba43d7c 100644
--- a/README.md
+++ b/README.md
@@ -268,6 +268,7 @@ Simply run `pihole -c` for some detailed information.
- [FAQs](https://discourse.pi-hole.net/c/faqs)
- [Feature requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
- [Wiki](https://github.com/pi-hole/pi-hole/wiki)
+- [Facebook](https://www.facebook.com/ThePiHole/)
-  [Tweet @The_Pi_Hole](https://twitter.com/The_Pi_Hole)
-  [Reddit /r/pihole](https://www.reddit.com/r/pihole/)
-  [Pi-hole channel](https://www.youtube.com/channel/UCT5kq9w0wSjogzJb81C9U0w)
From 2778d88e8acfdb40d4ad885903e5f9b54c56ac25 Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Wed, 12 Jul 2017 00:12:54 -0700
Subject: [PATCH 075/116] Fix missing `then` clause
---
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 419ad10e..74e2a61d 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1217,7 +1217,7 @@ install_dependent_packages() {
# amount of download traffic.
# NOTE: We may be able to use this installArray in the future to create a list of package that were
# installed by us, and remove only the installed packages, and not the entire list.
- if command -v debconf-apt-progress &> /dev/null;
+ if command -v debconf-apt-progress &> /dev/null; then
# For each package,
for i in "${argArray1[@]}"; do
echo -ne " ${INFO} Checking for $i..."
From 93d40b083e1c77b011c182f5214e1e058eaf3db4 Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Wed, 12 Jul 2017 11:40:18 -0700
Subject: [PATCH 076/116] Fix extentions of the JPG images
Some images are jpg and not png.
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 0ba43d7c..4a6a86c6 100644
--- a/README.md
+++ b/README.md
@@ -255,11 +255,11 @@ Simply run `pihole -c` for some detailed information.
```
-
+
-
+
# Get Help Or Connect With Us On The Web
From 74b912a0b71c1fd2027f4cc0c194fdf636d07dbb Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Wed, 12 Jul 2017 22:02:07 +0100
Subject: [PATCH 077/116] Check if FTL is already installed, do not download if
it is detected, and the sha1sum matches the remote This will probably break
some tests. I'll work that out in a bit Signed-off-by: Adam Warner
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 74e2a61d..8c026442 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1761,7 +1761,7 @@ FTLinstall() {
local binary="${1}"
local latesttag
local orig_dir
- local str="Installing FTL"
+ local str="Downloading and Installing FTL"
echo -ne " ${INFO} ${str}..."
# Get the current working directory
@@ -1774,6 +1774,7 @@ FTLinstall() {
echo -e " ${COL_LIGHT_RED}Error: Unable to get latest release location from GitHub${COL_NC}"
return 1
fi
+
# If the download worked,
if curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${latesttag%$'\r'}/${binary}" -o "/tmp/${binary}"; then
# get sha1 of the binary we just downloaded for verification.
@@ -1879,9 +1880,26 @@ FTLdetect() {
binary="pihole-FTL-linux-x86_32"
fi
- # Install FTL
- FTLinstall "${binary}" || return 1
+ #In the next section we check to see if FTL is already installed (in case of pihole -r).
+ #If the installed version matches the latest version, then check the installed sha1sum of the binary vs the remote sha1sum. If they do not match, then download
+ local FTLversion=$(/usr/bin/pihole-FTL tag)
+ local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
+ if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
+ # Install FTL
+ FTLinstall "${binary}" || return 1
+ else
+ local remoteSha1=$(curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1" | cut -d ' ' -f 1)
+ local localSha1=$(sha1sum "$(which pihole-FTL)" | cut -d ' ' -f 1)
+
+ echo -e " ${INFO} Existing FTL Binary detected. Checking sha1sum..."
+ if [[ "${remoteSha1}" != "${localSha1}" ]]; then
+ echo -e " ${INFO} Corruption detected..."
+ FTLinstall "${binary}" || return 1
+ else
+ echo -e " ${INFO} sha1sums match. No need to download!"
+ fi
+ fi
}
main() {
From bf70c2c6605e15caf433bf5830a7e6a474b22f3a Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Wed, 12 Jul 2017 22:52:03 +0100
Subject: [PATCH 078/116] initial changes to tests to take into account changes
to strings
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 2 +-
test/test_automated_install.py | 20 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 8c026442..3a53fca5 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1817,7 +1817,7 @@ FTLinstall() {
# Detect suitable FTL binary platform
FTLdetect() {
echo ""
- echo -e " ${INFO} Downloading latest version of FTL..."
+ echo -e " ${INFO} FTL Checks..."
# Local, named variables
local machine
diff --git a/test/test_automated_install.py b/test/test_automated_install.py
index 60b9dbb8..4a4f72aa 100644
--- a/test/test_automated_install.py
+++ b/test/test_automated_install.py
@@ -319,11 +319,11 @@ def test_FTL_detect_aarch64_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLdetect
''')
- expected_stdout = info_box + ' Downloading latest version of FTL...'
+ expected_stdout = info_box + ' FTL Checks...'
assert expected_stdout in detectPlatform.stdout
expected_stdout = tick_box + ' Detected ARM-aarch64 architecture'
assert expected_stdout in detectPlatform.stdout
- expected_stdout = tick_box + ' Installing FTL'
+ expected_stdout = tick_box + ' Downloading and Installing FTL'
assert expected_stdout in detectPlatform.stdout
def test_FTL_detect_armv6l_no_errors(Pihole):
@@ -336,11 +336,11 @@ def test_FTL_detect_armv6l_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLdetect
''')
- expected_stdout = info_box + ' Downloading latest version of FTL...'
+ expected_stdout = info_box + ' FTL Checks...'
assert expected_stdout in detectPlatform.stdout
expected_stdout = tick_box + ' Detected ARM-hf architecture (armv6 or lower)'
assert expected_stdout in detectPlatform.stdout
- expected_stdout = tick_box + ' Installing FTL'
+ expected_stdout = tick_box + ' Downloading and Installing FTL'
assert expected_stdout in detectPlatform.stdout
def test_FTL_detect_armv7l_no_errors(Pihole):
@@ -353,11 +353,11 @@ def test_FTL_detect_armv7l_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLdetect
''')
- expected_stdout = info_box + ' Downloading latest version of FTL...'
+ expected_stdout = info_box + ' FTL Checks...'
assert expected_stdout in detectPlatform.stdout
expected_stdout = tick_box + ' Detected ARM-hf architecture (armv7+)'
assert expected_stdout in detectPlatform.stdout
- expected_stdout = tick_box + ' Installing FTL'
+ expected_stdout = tick_box + ' Downloading and Installing FTL'
assert expected_stdout in detectPlatform.stdout
def test_FTL_detect_x86_64_no_errors(Pihole):
@@ -366,11 +366,11 @@ def test_FTL_detect_x86_64_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLdetect
''')
- expected_stdout = info_box + ' Downloading latest version of FTL...'
+ expected_stdout = info_box + ' FTL Checks...'
assert expected_stdout in detectPlatform.stdout
expected_stdout = tick_box + ' Detected x86_64 architecture'
assert expected_stdout in detectPlatform.stdout
- expected_stdout = tick_box + ' Installing FTL'
+ expected_stdout = tick_box + ' Downloading and Installing FTL'
assert expected_stdout in detectPlatform.stdout
def test_FTL_detect_unknown_no_errors(Pihole):
@@ -391,7 +391,7 @@ def test_FTL_download_aarch64_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLinstall pihole-FTL-aarch64-linux-gnu
''')
- expected_stdout = tick_box + ' Installing FTL'
+ expected_stdout = tick_box + ' Downloading and Installing FTL'
assert expected_stdout in download_binary.stdout
error = 'Error: Download of binary from Github failed'
assert error not in download_binary.stdout
@@ -405,7 +405,7 @@ def test_FTL_download_unknown_fails_no_errors(Pihole):
source /opt/pihole/basic-install.sh
FTLinstall pihole-FTL-mips
''')
- expected_stdout = cross_box + ' Installing FTL'
+ expected_stdout = cross_box + ' Downloading and Installing FTL'
assert expected_stdout in download_binary.stdout
error = 'Error: URL not found'
assert error in download_binary.stdout
From 9934f505a5c717d39167f705a818b25e8cdfda5a Mon Sep 17 00:00:00 2001
From: Molikuner
Date: Thu, 13 Jul 2017 23:18:40 +0200
Subject: [PATCH 079/116] Fix URL extension parsing
when there is a querystring Pi-hole sometimes parsed a wrong extension
---
advanced/index.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/advanced/index.php b/advanced/index.php
index 1dd5acc7..2facd144 100644
--- a/advanced/index.php
+++ b/advanced/index.php
@@ -21,8 +21,9 @@ if ($serverName === 'pi.hole')
}
// 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);
-$uriExt = pathinfo($uri, PATHINFO_EXTENSION);
+$uriExt = pathinfo(strtok($uri,'\?'), PATHINFO_EXTENSION);
// Define which URL extensions get rendered as "Website Blocked"
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
From e1f818ffb7edc8d7257f40f85d39007a804c7d8c Mon Sep 17 00:00:00 2001
From: Jacob Salmela <4aad0716@opayq.com>
Date: Fri, 14 Jul 2017 10:53:45 -0500
Subject: [PATCH 080/116] Tweak/debug improvements (#1585)
* check for CIDR notation when comparing IPv6 address to that found in setupVars.conf
* highlight bad address entries in pihole.log and reference a corresponding FAQ
* show header output if Pi-holes x-header does not match
* fix automated mode when running from the dashboard. It would previously not automatically upload and generate a token.
* show disclaimer message
* undocumented feature for now: obfuscate domains in pihole.log so they are not visible when sent to the Pi-hole developers. We need to make an additonal flag for this in the pihole command. if the variable OBFUSCATE has a value, it will replace the domain in the log with a placeholder value
* fix small typo in the disclaimer
---
advanced/Scripts/piholeDebug.sh | 68 ++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 13 deletions(-)
diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh
index f98d986a..60b04b73 100755
--- a/advanced/Scripts/piholeDebug.sh
+++ b/advanced/Scripts/piholeDebug.sh
@@ -39,6 +39,8 @@ else
OVER="\r\033[K"
fi
+OBFUSCATED_PLACEHOLDER=""
+
# FAQ URLs for use in showing the debug log
FAQ_UPDATE_PI_HOLE="${COL_CYAN}https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249${COL_NC}"
FAQ_CHECKOUT_COMMAND="${COL_CYAN}https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#checkout${COL_NC}"
@@ -47,6 +49,7 @@ FAQ_HARDWARE_REQUIREMENTS_PORTS="${COL_CYAN}https://discourse.pi-hole.net/t/hard
FAQ_GATEWAY="${COL_CYAN}https://discourse.pi-hole.net/t/why-is-a-default-gateway-important-for-pi-hole/3546${COL_NC}"
FAQ_ULA="${COL_CYAN}https://discourse.pi-hole.net/t/use-ipv6-ula-addresses-for-pi-hole/2127${COL_NC}"
FAQ_FTL_COMPATIBILITY="${COL_CYAN}https://github.com/pi-hole/FTL#compatibility-list${COL_NC}"
+FAQ_BAD_ADDRESS="${COL_CYAN}https://discourse.pi-hole.net/t/why-do-i-see-bad-address-at-in-pihole-log/3972${COL_NC}"
# Other URLs we may use
FORUMS_URL="${COL_CYAN}https://discourse.pi-hole.net${COL_NC}"
@@ -159,6 +162,17 @@ ${PIHOLE_FTL_LOG}
${PIHOLE_WEB_SERVER_ACCESS_LOG_FILE}
${PIHOLE_WEB_SERVER_ERROR_LOG_FILE})
+DISCLAIMER="This process collects information from your Pi-hole, and optionally uploads it to a unique and random directory on tricorder.pi-hole.net.
+
+The intent of this script is to allow users to self-diagnose their installations. This is accomplished by running tests against our software and providing the user with links to FAQ articles when a problem is detected. Since we are a small team and Pi-hole has been growing steadily, it is our hope that this will help us spend more time on development.
+
+NOTE: All log files auto-delete after 48 hours and ONLY the Pi-hole developers can access your data via the given token. We have taken these extra steps to secure your data and will work to further reduce any personal information gathered.
+"
+
+show_disclaimer(){
+ log_write "${DISCLAIMER}"
+}
+
source_setup_variables() {
# Display the current test that is running
log_write "\n${COL_LIGHT_PURPLE}*** [ INITIALIZING ]${COL_NC} Sourcing setup variables"
@@ -203,6 +217,7 @@ copy_to_debug_log() {
initiate_debug() {
# Clear the screen so the debug log is readable
clear
+ show_disclaimer
# Display that the debug process is beginning
log_write "${COL_LIGHT_PURPLE}*** [ INITIALIZING ]${COL_NC}"
# Timestamp the start of the log
@@ -457,7 +472,7 @@ does_ip_match_setup_vars() {
# If it's an IPv6 address
if [[ "${protocol}" == "6" ]]; then
# Strip off the / (CIDR notation)
- if [[ "${ip_address%/*}" == "${setup_vars_ip}" ]]; then
+ if [[ "${ip_address%/*}" == "${setup_vars_ip%/*}" ]]; then
# if it matches, show it in green
log_write " ${COL_LIGHT_GREEN}${ip_address%/*}${COL_NC} matches the IP found in ${PIHOLE_SETUP_VARS_FILE}"
else
@@ -659,6 +674,10 @@ check_x_headers() {
block_page_working="X-Pi-hole: A black hole for Internet advertisements."
local dashboard_working
dashboard_working="X-Pi-hole: The Pi-hole Web interface is working!"
+ local full_curl_output_block_page
+ full_curl_output_block_page="$(curl -Is localhost)"
+ local full_curl_output_dashboard
+ full_curl_output_dashboard="$(curl -Is localhost/admin/)"
# If the X-header found by curl matches what is should be,
if [[ $block_page == "$block_page_working" ]]; then
# display a success message
@@ -666,6 +685,7 @@ check_x_headers() {
else
# Otherwise, show an error
log_write "$CROSS ${COL_LIGHT_RED}X-Header does not match or could not be retrieved.${COL_NC}"
+ log_write "${COL_LIGHT_RED}${full_curl_output_block_page}${COL_NC}"
fi
# Same logic applies to the dashbord as above, if the X-Header matches what a working system shoud have,
@@ -675,6 +695,7 @@ check_x_headers() {
else
# Othewise, it's a failure since the X-Headers either don't exist or have been modified in some way
log_write "$CROSS ${COL_LIGHT_RED}X-Header does not match or could not be retrieved.${COL_NC}"
+ log_write "${COL_LIGHT_RED}${full_curl_output_dashboard}${COL_NC}"
fi
}
@@ -972,8 +993,39 @@ analyze_pihole_log() {
local pihole_log_head=()
pihole_log_head=( $(head -n 20 ${PIHOLE_LOG}) )
log_write " ${COL_CYAN}-----head of $(basename ${PIHOLE_LOG})------${COL_NC}"
+ local error_to_check_for
+ local line_to_obfuscate
+ local obfuscated_line
for head_line in "${pihole_log_head[@]}"; do
- log_write " ${head_line}"
+ # A common error in the pihole.log is when there is a non-hosts formatted file
+ # that the DNS server is attempting to read. Since it's not formatted
+ # correctly, there will be an entry for "bad address at line n"
+ # So we can check for that here and highlight it in red so the user can see it easily
+ error_to_check_for=$(echo ${head_line} | grep 'bad address at')
+ # Some users may not want to have the domains they visit sent to us
+ # To that end, we check for lines in the log that would contain a domain name
+ line_to_obfuscate=$(echo ${head_line} | grep ': query\|: forwarded\|: reply')
+ # If the variable contains a value, it found an error in the log
+ if [[ -n ${error_to_check_for} ]]; then
+ # So we can print it in red to make it visible to the user
+ log_write " ${CROSS} ${COL_LIGHT_RED}${head_line}${COL_NC} (${FAQ_BAD_ADDRESS})"
+ else
+ # If the variable does not a value (the current default behavior), so do not obfuscate anything
+ if [[ -z ${OBFUSCATE} ]]; then
+ log_write " ${head_line}"
+ # Othwerise, a flag was passed to this command to obfuscate domains in the log
+ else
+ # So first check if there are domains in the log that should be obfuscated
+ if [[ -n ${line_to_obfuscate} ]]; then
+ # If there are, we need to use awk to replace only the domain name (the 6th field in the log)
+ # so we substitue the domain for the placeholder value
+ obfuscated_line=$(echo ${line_to_obfuscate} | awk -v placeholder="${OBFUSCATED_PLACEHOLDER}" '{sub($6,placeholder); print $0}')
+ log_write " ${obfuscated_line}"
+ else
+ log_write " ${head_line}"
+ fi
+ fi
+ fi
done
log_write ""
# Set the IFS back to what it was
@@ -1019,17 +1071,7 @@ upload_to_tricorder() {
# let the user know
log_write "${INFO} Debug script running in automated mode"
# and then decide again which tool to use to submit it
- if command -v openssl &> /dev/null; then
- # If openssl is available, use it
- log_write "${INFO} Using ${COL_LIGHT_GREEN}openssl${COL_NC} for transmission."
- # Save the token returned by our server in a variable
- tricorder_token=$(openssl s_client -quiet -connect tricorder.pi-hole.net:${TRICORDER_SSL_PORT_NUMBER} 2> /dev/null < /dev/stdin)
- else
- # Otherwise, fallback to netcat
- log_write "${INFO} Using ${COL_YELLOW}netcat${COL_NC} for transmission."
- # Save the token returned by our server in a variable
- tricorder_token=$(nc tricorder.pi-hole.net ${TRICORDER_NC_PORT_NUMBER} < /dev/stdin)
- fi
+ tricorder_use_nc_or_ssl
# If we're not running in automated mode,
else
echo ""
From 7d56e2a9371e952b5ffea24a298615a73e098b11 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Fri, 14 Jul 2017 20:54:41 +0100
Subject: [PATCH 081/116] `FTL` has an `L` in it, innit?
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeDebug.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh
index 60b04b73..ea387b5a 100755
--- a/advanced/Scripts/piholeDebug.sh
+++ b/advanced/Scripts/piholeDebug.sh
@@ -598,7 +598,7 @@ compare_port_to_service_assigned() {
# The programs we use may change at some point, so they are in a varible here
local resolver="dnsmasq"
local web_server="lighttpd"
- local ftl="pihole-FT"
+ local ftl="pihole-FTL"
if [[ "${service_name}" == "${resolver}" ]] || [[ "${service_name}" == "${web_server}" ]] || [[ "${service_name}" == "${ftl}" ]]; then
# if port 53 is dnsmasq, show it in green as it's standard
log_write "[${COL_LIGHT_GREEN}${port_number}${COL_NC}] is in use by ${COL_LIGHT_GREEN}${service_name}${COL_NC}"
@@ -615,7 +615,7 @@ check_required_ports() {
# so we can detect any issues
local resolver="dnsmasq"
local web_server="lighttpd"
- local ftl="pihole-FT"
+ local ftl="pihole-FTL"
# Create an array for these ports in use
ports_in_use=()
# Sort the addresses and remove duplicates
From 9464b71a6e37a4067932362fd57f367ef7872d2b Mon Sep 17 00:00:00 2001
From: Mcat12
Date: Mon, 26 Jun 2017 09:51:21 -0400
Subject: [PATCH 082/116] Remove /* from IPv6 as well as IPv4
Fixes Discourse issue: https://discourse.pi-hole.net/t/ipv6-aaaa-dns-issue/3830
Signed-off-by: Adam Warner
# Conflicts:
# gravity.sh
---
gravity.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gravity.sh b/gravity.sh
index 285ce5c3..41e3c68a 100755
--- a/gravity.sh
+++ b/gravity.sh
@@ -46,9 +46,9 @@ else
exit 1
fi
-#Remove the /* from the end of the IPv4addr.
+#Remove the /* from the end of the IP addresses
IPV4_ADDRESS=${IPV4_ADDRESS%/*}
-IPV6_ADDRESS=${IPV6_ADDRESS}
+IPV6_ADDRESS=${IPV6_ADDRESS%/*}
# Variables for various stages of downloading and formatting the list
basename=pihole
From edb594461d3ac683934eb9b256d93946f92823ad Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Wed, 28 Jun 2017 22:54:02 +0100
Subject: [PATCH 083/116] Remove CIDR from IPv6 address when detecting it in
the install script
Signed-off-by: Adam Warner
# Conflicts:
# automated install/basic-install.sh
---
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 053e04ba..2cf2c61d 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -344,8 +344,8 @@ useIPv6dialog() {
# Determine type of found IPv6 addresses
for i in "${IPV6_ADDRESSES[@]}"; do
result=$(testIPv6 "$i")
- [[ "${result}" == "ULA" ]] && ULA_ADDRESS="$i"
- [[ "${result}" == "GUA" ]] && GUA_ADDRESS="$i"
+ [[ "${result}" == "ULA" ]] && ULA_ADDRESS="${i%/*}"
+ [[ "${result}" == "GUA" ]] && GUA_ADDRESS="${i%/*}"
done
# Determine which address to be used: Prefer ULA over GUA or don't use any if none found
@@ -1510,10 +1510,9 @@ main() {
else
echo "::: Update complete!"
fi
-
if [[ ${INSTALL_WEB} == true ]]; then
if (( ${#pw} > 0 )) ; then
- echo ":::"
+ echo ":::"
echo "::: Note: As security measure a password has been installed for your web interface"
echo "::: The currently set password is"
echo "::: ${pw}"
@@ -1524,7 +1523,8 @@ main() {
fi
echo ":::"
- echo "::: The install log is located at: /etc/pihole/install.log"
+ echo "::: The install log is located at: /etc/pihole/install.log
+ "
}
if [[ "${PH_TEST}" != true ]] ; then
From 9101916719a86ab9478496bf18e4e0baa42ab3ab Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Sat, 24 Jun 2017 15:49:16 -0700
Subject: [PATCH 084/116] Test exclusion for sourced files SC1090.
Signed-off-by: Dan Schaper
---
test/test_shellcheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_shellcheck.py b/test/test_shellcheck.py
index fa342027..9c4f141b 100644
--- a/test/test_shellcheck.py
+++ b/test/test_shellcheck.py
@@ -7,7 +7,7 @@ run_local = testinfra.get_backend(
def test_scripts_pass_shellcheck():
''' Make sure shellcheck does not find anything wrong with our shell scripts '''
- shellcheck = "find . -type f \( -name 'update.sh' -o -name 'piholeDebug.sh' \) | while read file; do shellcheck \"$file\"; done;"
+ shellcheck = "find . -type f \( -name 'update.sh' -o -name 'piholeDebug.sh' \) | while read file; do shellcheck \"$file\" -e SC1090; done;"
results = run_local(shellcheck)
print results.stdout
assert '' == results.stdout
From 66f32b7601d52266e7f244cda3f9334f06d5e6ce Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Sun, 25 Jun 2017 12:26:16 -0700
Subject: [PATCH 085/116] Remove testing for `debug` as this is getting a
re-write by Jacob.
Signed-off-by: Dan Schaper
---
test/test_shellcheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_shellcheck.py b/test/test_shellcheck.py
index 9c4f141b..1b6b35a7 100644
--- a/test/test_shellcheck.py
+++ b/test/test_shellcheck.py
@@ -7,7 +7,7 @@ run_local = testinfra.get_backend(
def test_scripts_pass_shellcheck():
''' Make sure shellcheck does not find anything wrong with our shell scripts '''
- shellcheck = "find . -type f \( -name 'update.sh' -o -name 'piholeDebug.sh' \) | while read file; do shellcheck \"$file\" -e SC1090; done;"
+ shellcheck = "find . -type f -name 'update.sh' | while read file; do shellcheck \"$file\" -e SC1090; done;"
results = run_local(shellcheck)
print results.stdout
assert '' == results.stdout
From 05c8687041be34065724fd2e33783a47feae10ff Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Sun, 25 Jun 2017 14:21:41 -0700
Subject: [PATCH 086/116] Integrate DL's update.sh fixes.
`shellcheck -x` for following files.
Do not test for included files SC1091
Signed-off-by: Dan Schaper
Signed-off-by: Adam Warner
# Conflicts:
# advanced/Scripts/update.sh
---
advanced/Scripts/update.sh | 23 ++++++++++++++++-------
test/test_shellcheck.py | 2 +-
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index 6aef183b..e3a7f8fd 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -19,8 +19,14 @@ readonly ADMIN_INTERFACE_DIR="/var/www/html/admin"
readonly PI_HOLE_GIT_URL="https://github.com/pi-hole/pi-hole.git"
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
+# shellcheck disable=SC2034
PH_TEST=true
-source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh
+
+# Have to ignore the following rule as spaces in paths are not supported by ShellCheck
+#shellcheck disable=SC1090
+source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
+
+source "/opt/pihole/COL_TABLE"
# is_repo() sourced from basic-install.sh
# make_repo() sourced from basic-install.sh
@@ -30,14 +36,14 @@ source ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh
GitCheckUpdateAvail() {
local directory="${1}"
curdir=$PWD
- cd "${directory}"
+ cd "${directory}" || return
# Fetch latest changes in this repo
git fetch --quiet origin
# @ alone is a shortcut for HEAD. Older versions of git
# need @{0}
- LOCAL="$(git rev-parse @{0})"
+ LOCAL="$("git rev-parse @{0}")"
# The suffix @{upstream} to a branchname
# (short form @{u}) refers
@@ -46,7 +52,7 @@ GitCheckUpdateAvail() {
# (configured with branch..remote and
# branch..merge). A missing branchname
# defaults to the current one.
- REMOTE="$(git rev-parse @{upstream})"
+ REMOTE="$("git rev-parse @{upstream}")"
if [[ ${#LOCAL} == 0 ]]; then
echo "::: Error: Local revision could not be obtained, ask Pi-hole support."
@@ -62,7 +68,7 @@ GitCheckUpdateAvail() {
fi
# Change back to original directory
- cd "${curdir}"
+ cd "${curdir}" || exit
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
# Local branch is behind remote branch -> Update
@@ -77,8 +83,10 @@ GitCheckUpdateAvail() {
FTLcheckUpdate() {
- local FTLversion=$(/usr/bin/pihole-FTL tag)
- local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
+ local FTLversion
+ FTLversion=$(/usr/bin/pihole-FTL tag)
+ local FTLlatesttag
+ FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
return 0
@@ -90,6 +98,7 @@ FTLcheckUpdate() {
main() {
local pihole_version_current
local web_version_current
+ #shellcheck disable=1090,2154
source "${setupVars}"
#This is unlikely
diff --git a/test/test_shellcheck.py b/test/test_shellcheck.py
index 1b6b35a7..5b1a8961 100644
--- a/test/test_shellcheck.py
+++ b/test/test_shellcheck.py
@@ -7,7 +7,7 @@ run_local = testinfra.get_backend(
def test_scripts_pass_shellcheck():
''' Make sure shellcheck does not find anything wrong with our shell scripts '''
- shellcheck = "find . -type f -name 'update.sh' | while read file; do shellcheck \"$file\" -e SC1090; done;"
+ shellcheck = "find . -type f -name 'update.sh' | while read file; do shellcheck -x \"$file\" -e SC1090,SC1091; done;"
results = run_local(shellcheck)
print results.stdout
assert '' == results.stdout
From 3631d1349ebe06ad804df8ca4ba008ca1b917433 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sat, 15 Jul 2017 20:11:06 +1000
Subject: [PATCH 087/116] Prevent Web Admin from printing restartdns colour
codes (#1575)
* Prevent Web Admin from printing unnecessary msgs
* Make DNS restart behaviour consistent
---
advanced/Scripts/webpage.sh | 17 +++++++++--------
pihole | 24 ++++++++++++++++--------
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index 5aae18f7..42272122 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -221,18 +221,19 @@ Reboot() {
}
RestartDNS() {
- local str="Restarting dnsmasq"
- echo -ne " ${INFO} ${str}..."
- if [[ -x "$(command -v systemctl)" ]]; then
- systemctl restart dnsmasq
+ local str="Restarting DNS service"
+ [[ -t 1 ]] && echo -ne " ${INFO} ${str}"
+ if command -v systemctl &> /dev/null; then
+ output=$( { systemctl restart dnsmasq; } 2>&1 )
else
- service dnsmasq restart
+ output=$( { service dnsmasq restart; } 2>&1 )
fi
- if [[ "$?" == 0 ]]; then
- echo -e "${OVER} ${TICK} ${str}"
+ if [[ -z "${output}" ]]; then
+ [[ -t 1 ]] && echo -e "${OVER} ${TICK} ${str}"
else
- echo -e "${OVER} ${CROSS} ${str}"
+ [[ ! -t 1 ]] && OVER=""
+ echo -e "${OVER} ${CROSS} ${output}"
fi
}
diff --git a/pihole b/pihole
index 3c321b93..b4b5e886 100755
--- a/pihole
+++ b/pihole
@@ -173,24 +173,32 @@ versionFunc() {
restartDNS() {
dnsmasqPid=$(pidof dnsmasq)
+ local str="Restarting DNS service"
+ echo -ne " ${INFO} ${str}"
if [[ "${dnsmasqPid}" ]]; then
# Service already running - reload config
- echo -ne " ${INFO} Restarting dnsmasq"
if [[ -x "$(command -v systemctl)" ]]; then
- systemctl restart dnsmasq
+ output=$( { systemctl restart dnsmasq; } 2>&1 )
else
- service dnsmasq restart
+ output=$( { service dnsmasq restart; } 2>&1 )
+ fi
+ if [[ -z "${output}" ]]; then
+ echo -e "${OVER} ${TICK} ${str}"
+ else
+ echo -e "${OVER} ${CROSS} ${output}"
fi
- [[ "$?" == 0 ]] && echo -e "${OVER} ${TICK} Restarted dnsmasq" || echo -e "${OVER} ${CROSS} Failed to restart dnsmasq"
else
# Service not running, start it up
- echo -ne " ${INFO} Starting dnsmasq"
if [[ -x "$(command -v systemctl)" ]]; then
- systemctl start dnsmasq
+ output=$( { systemctl start dnsmasq; } 2>&1 )
else
- service dnsmasq start
+ output=$( { service dnsmasq start; } 2>&1 )
+ fi
+ if [[ -z "${output}" ]]; then
+ echo -e "${OVER} ${TICK} ${str}"
+ else
+ echo -e "${OVER} ${CROSS} ${output}"
fi
- [[ "$?" == 0 ]] && echo -e "${OVER} ${TICK} Restarted dnsmasq" || echo -e "${OVER} ${CROSS} Failed to restart dnsmasq"
fi
}
From 3a50b91722ed438e7db86e2b0a147b91642116c8 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sat, 15 Jul 2017 20:56:40 +1000
Subject: [PATCH 088/116] User-friendly queryFunc() output (#1483)
* User-friendly queryFunc() output
* Silence grep errors
* Provide 'pihole -q -h' help output
* Rewrite option handling
* Loop through grep stdout to make query output user friendly
* Add -adlist option to show block list URL instead of internal file name
* Limit general searches to 10 matches per block list
* Add -all option to override 10 match limit
* Fixed 'pihole -h' wording
* Further query optimisations
* Optimised scanList() output by switching folder
* Re-added processWildcards() function
* Added "-bp" exact matching option for use with block page
* Standardised query output
* Separated wildcard search from blacklist/whitelist search
* Optimised sorting by sorting glob output and not scanList() output
* Fixed result skipping
* Add text for wildcard result on exact query
* Fix wildcard result output
* Multiple wildcard matches on exact query could cause unexpected output
* Remove unnecessary replacement
* Make grep only output matching text
* HOSTS format lists will also output the IP address
* That substitution was necessary
* Remove IP address from HOSTS format lists
* Filter unwanted content
* Add /dev/null to grep, to always print file name (even when searching only one block list)
* Use three seds to remove unwanted content from block lists
* Merge with development
* Simplify queryFunc code
---
pihole | 244 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 206 insertions(+), 38 deletions(-)
diff --git a/pihole b/pihole
index b4b5e886..1bd35dbb 100755
--- a/pihole
+++ b/pihole
@@ -87,10 +87,14 @@ scanList(){
domain="${1}"
list="${2}"
method="${3}"
- if [[ ${method} == "-exact" ]] ; then
- grep -i -E "(^|\s)${domain}($|\s)" "${list}"
+
+ # Switch folder, preventing grep from printing file path
+ cd "/etc/pihole" || return 1
+
+ if [[ -n "${method}" ]]; then
+ grep -i -E -l "(^|\s|\/)${domain}($|\s|\/)" ${list} /dev/null 2> /dev/null
else
- grep -i "${domain}" "${list}"
+ grep -i "${domain}" ${list} /dev/null 2> /dev/null
fi
}
@@ -110,46 +114,210 @@ processWildcards() {
}
queryFunc() {
- domain="${2}"
-
- if [[ -z "${domain}" ]]; then
- echo -e " ${COL_LIGHT_RED}Invalid option${COL_NC}
- Try 'pihole query --help' for more information."
+ options="$*"
+ options="${options/-q /}"
+
+ if [[ "${options}" == "-h" ]] || [[ "${options}" == "--help" ]]; then
+ echo "Usage: pihole -q [option]
+Example: 'pihole -q -exact domain.com'
+Query the adlists for a specified domain
+
+Options:
+ -adlist Print the name of the block list URL
+ -exact Search the block lists for exact domain matches
+ -all Return all query matches within a block list
+ -h, --help Show this help dialog"
+ exit 0
+ fi
+
+ if [[ "${options}" == *"-exact"* ]]; then
+ method="exact"
+ exact=true
+ fi
+
+ if [[ "${options}" == *"-adlist"* ]]; then
+ adlist=true
+ fi
+
+ if [[ "${options}" == *"-bp"* ]]; then
+ method="exact"
+ blockpage=true
+ fi
+
+ if [[ "${options}" == *"-all"* ]]; then
+ all=true
+ fi
+
+ # Strip valid options, leaving only the domain and invalid options
+ options=$(sed 's/ \?-\(exact\|adlist\|bp\|all\) \?//g' <<< "$options")
+
+ # Handle errors
+ if [[ "${options}" == *" "* ]]; then
+ error=true
+ str="Unknown option specified"
+ elif [[ "${options}" == "-q" ]]; then
+ error=true
+ str="No domain specified"
+ fi
+
+ if [[ -n "${error}" ]]; then
+ echo -e " ${COL_LIGHT_RED}${str}${COL_NC}
+ Try 'pihole -q --help' for more information."
exit 1
fi
-
- method="${3}"
- lists=( /etc/pihole/list.* /etc/pihole/blacklist.txt)
- for list in ${lists[@]}; do
- if [ -e "${list}" ]; then
- result=$(scanList ${domain} ${list} ${method})
- # Remove empty lines before couting number of results
- count=$(sed '/^\s*$/d' <<< "$result" | wc -l)
- echo "${list} (${count} results)"
- if [[ ${count} > 0 ]]; then
- echo "${result}"
- fi
- echo ""
- else
- echo -e " ${CROSS} List does not exist"
- echo ""
- fi
- done
- # Scan for possible wildcard matches
- if [ -e "${wildcardlist}" ]; then
- local wildcards=($(processWildcards "${domain}"))
- for domain in ${wildcards[@]}; do
- result=$(scanList "\/${domain}\/" ${wildcardlist})
- # Remove empty lines before couting number of results
- count=$(sed '/^\s*$/d' <<< "$result" | wc -l)
- if [[ ${count} > 0 ]]; then
- echo -e " ${TICK} Wildcard blocking ${domain} (${count} results)"
- echo "${result}"
- echo ""
+ # If domain contains non ASCII characters, convert domain to punycode if python is available
+ # Cr: https://serverfault.com/a/335079
+ if [[ "$options" = *[![:ascii:]]* ]]; then
+ if command -v python &> /dev/null; then
+ query=$(python -c 'import sys;print sys.argv[1].decode("utf-8").encode("idna")' "${options}")
+ fi
+ else
+ query="${options}"
+ fi
+
+ # Scan Whitelist and Blacklist
+ lists="whitelist.txt blacklist.txt"
+ results=($(scanList "${query}" "${lists}" "${method}"))
+
+ if [[ -n "${results[*]}" ]]; then
+ # Loop through each scanList line to print appropriate title
+ for result in "${results[@]}"; do
+ filename="${result/:*/}"
+ if [[ -n "$exact" ]]; then
+ printf " Exact result in %s\n" "${filename}"
+ elif [[ -n "$blockpage" ]]; then
+ printf " [i] %s\n" "${filename}"
+ else
+ domain="${result/*:/}"
+ if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
+ printf " Result from %s\n" "${filename}"
+ fi
+ printf " %s\n" "${domain}"
+ filename_prev="${filename}"
fi
done
fi
+
+ # Scan Wildcards
+ if [[ -e "${wildcardlist}" ]]; then
+ wildcards=($(processWildcards "${query}"))
+
+ for match in "${wildcards[@]}"; do
+ results=($(scanList "\/${match}\/" ${wildcardlist}))
+
+ if [[ -n "${results[*]}" ]]; then
+ # Remove empty lines before couting number of results
+ count=$(sed '/^\s*$/d' <<< "${results[@]}" | wc -l)
+ if [[ "${count}" -ge 0 ]]; then
+ blResult=true
+ if [[ -z "${blockpage}" ]]; then
+ printf " Wildcard result in %s\n" "${wildcardlist/*dnsmasq.d\/}"
+ fi
+
+ if [[ -n "${blockpage}" ]]; then
+ echo " ${INFO} ${match}"
+ else
+ echo " *.${match}"
+ fi
+ fi
+ fi
+ done
+
+ [[ -n "${blResult}" ]] && [[ -n "${blockpage}" ]] && exit 0
+ fi
+
+ # Glob *.domains file names, remove file paths and sort by list number
+ lists_raw=(/etc/pihole/*.domains)
+ IFS_OLD=$IFS
+ IFS=$'\n'
+ lists=$(sort -t . -k 2 -g <<< "${lists_raw[*]//\/etc\/pihole\//}")
+
+ # Scan Domains files
+ results=($(scanList "${query}" "${lists}" "${method}"))
+
+ # Handle notices
+ if [[ -z "${blResult}" ]] && [[ -z "${results[*]}" ]]; then
+ notice=true
+ str="No ${method/t/t }results found for ${query} found within block lists"
+ elif [[ -z "${all}" ]] && [[ "${#results[*]}" -ge 16000 ]]; then
+ # 16000 chars is 15 chars X 1000 lines worth of results
+ notice=true
+ str="Hundreds of ${method/t/t }results found for ${query}
+ This can be overriden using the -all option"
+ fi
+
+ if [[ -n "${notice}" ]]; then
+ echo -e " ${INFO} ${str}"
+ exit
+ fi
+
+ # Remove unwanted content from results
+ if [[ -z "${method}" ]]; then
+ results=($(sed "/:#/d" <<< "${results[*]}")) # Lines starting with comments
+ results=($(sed "s/[ \t]#.*//g" <<< "${results[*]}")) # Comments after domain
+ results=($(sed "s/:.*[ \t]/:/g" <<< "${results[*]}")) # IP address
+ fi
+ IFS=$IFS_OLD
+
+ # Get adlist content as array
+ if [[ -n "${adlist}" ]] || [[ -n "${blockpage}" ]]; then
+ if [[ -f "/etc/pihole/adlists.list" ]]; then
+ for url in $(< /etc/pihole/adlists.list); do
+ if [[ "${url:0:4}" == "http" ]] || [[ "${url:0:3}" == "www" ]]; then
+ adlists+=("$url")
+ fi
+ done
+ else
+ echo -e " ${COL_LIGHT_RED}The file '/etc/pihole/adlists.list' was not found${COL_NC}"
+ exit 1
+ fi
+ fi
+
+ if [[ -n "${results[*]}" ]]; then
+ if [[ -n "${exact}" ]]; then
+ echo " Exact result(s) for ${query} found in:"
+ fi
+
+ for result in "${results[@]}"; do
+ filename="${result/:*/}"
+
+ # Convert file name to URL name for -adlist or -bp options
+ if [[ -n "${adlist}" ]] || [[ -n "${blockpage}" ]]; then
+ filenum=("${filename/list./}")
+ filenum=("${filenum/.*/}")
+ filename="${adlists[$filenum]}"
+ fi
+
+ if [[ -n "${exact}" ]]; then
+ printf " %s\n" "${filename}"
+ elif [[ -n "${blockpage}" ]]; then
+ printf " [%s] %s\n" "${filenum}" "${filename}"
+ else # Standard query output
+
+ # Print filename heading once per file, not for every match
+ if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
+ unset count
+ printf " Result from %s\n" "${filename}"
+ else
+ let count++
+ fi
+
+ # Print matching domain if $max_count has not been reached
+ [[ -z "${all}" ]] && max_count="20"
+ if [[ -z "${all}" ]] && [[ "${count}" -eq "${max_count}" ]]; then
+ echo " Over $count results found, skipping rest of file"
+ elif [[ -z "${all}" ]] && [[ "${count}" -gt "${max_count}" ]]; then
+ continue
+ else
+ domain="${result/*:/}"
+ printf " %s\n" "${domain}"
+ fi
+ filename_prev="${filename}"
+ fi
+ done
+ fi
+
exit 0
}
@@ -438,7 +606,7 @@ Options:
-l, logging Specify whether the Pi-hole log should be used
Add '-h' for more info on logging usage
-q, query Query the adlists for a specified domain
- Add '-exact' AFTER a specified domain for exact match
+ Add '-h' for more info on query usage
-up, updatePihole Update Pi-hole subsystems
-v, version Show installed versions of Pi-hole, Admin Console & FTL
Add '-h' for more info on version usage
From 8af9853b9a516367031178ba836246f196e1ef55 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sun, 16 Jul 2017 22:32:34 +1000
Subject: [PATCH 089/116] Fixed minor formatting issues
* Removed useless echo
* Quoted and braced conditionals
* Explicit escaping of newline
* Fixed arrays implicitly concatenating (SC2199)
* Fixed incorrect variable used in checkout web
---
advanced/Scripts/piholeCheckout.sh | 39 +++++++++++++++---------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index f9add489..44058111 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -26,7 +26,7 @@ source ${coltable}
check_download_exists() {
status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
- if echo "$status" | grep -q "404"; then
+ if grep -q "404" <<< "$status"; then
return 1
else
return 0
@@ -74,17 +74,17 @@ get_binary_name() {
local str
str="Detecting architecture"
echo -ne " ${INFO} ${str}..."
- if [[ ${machine} == arm* || ${machine} == *aarch* ]]; then
+ if [[ "${machine}" == "arm"* || "${machine}" == *"aarch"* ]]; then
# ARM
local rev
rev=$(uname -m | sed "s/[^0-9]//g;")
local lib
lib=$(ldd /bin/ls | grep -E '^\s*/lib' | awk '{ print $1 }')
- if [[ "$lib" == "/lib/ld-linux-aarch64.so.1" ]]; then
+ if [[ "${lib}" == "/lib/ld-linux-aarch64.so.1" ]]; then
echo -e "${OVER} ${TICK} Detected ARM-aarch64 architecture"
binary="pihole-FTL-aarch64-linux-gnu"
- elif [[ "$lib" == "/lib/ld-linux-armhf.so.3" ]]; then
- if [ "$rev" -gt "6" ]; then
+ elif [[ "${lib}" == "/lib/ld-linux-armhf.so.3" ]]; then
+ if [[ "$rev" -gt "6" ]]; then
echo -e "${OVER} ${TICK} Detected ARM-hf architecture (armv7+)"
binary="pihole-FTL-arm-linux-gnueabihf"
else
@@ -95,17 +95,17 @@ get_binary_name() {
echo -e "${OVER} ${TICK} Detected ARM architecture"
binary="pihole-FTL-arm-linux-gnueabi"
fi
- elif [[ $machine == ppc ]]; then
+ elif [[ "${machine}" == "ppc" ]]; then
# PowerPC
- echo "::: Detected PowerPC architecture"
+ echo -e "${OVER} ${TICK} Detected PowerPC architecture"
binary="pihole-FTL-powerpc-linux-gnu"
- elif [[ ${machine} == x86_64 ]]; then
+ elif [[ "${machine}" == "x86_64" ]]; then
# 64bit
echo -e "${OVER} ${TICK} Detected x86_64 architecture"
binary="pihole-FTL-linux-x86_64"
else
# Something else - we try to use 32bit executable and warn the user
- if [[ ! ${machine} == i686 ]]; then
+ if [[ ! "${machine}" == "i686" ]]; then
echo -e "${OVER} ${CROSS} ${str}...
${COL_LIGHT_RED}Not able to detect architecture (unknown: ${machine}), trying 32bit executable
Contact support if you experience issues (e.g: FTL not running)${COL_NC}"
@@ -182,7 +182,7 @@ checkout_pull_branch() {
if [[ "$git_pull" == *"up-to-date"* ]]; then
echo -e " ${INFO} $(git pull)"
else
- echo -e "$git_pull\n"
+ echo -e "$git_pull\\n"
fi
return 0
@@ -193,13 +193,13 @@ warning1() {
echo " Features that work on the master branch, may not on a development branch"
echo -e " ${COL_LIGHT_RED}This feature is NOT supported unless a Pi-hole developer explicitly asks!${COL_NC}"
read -r -p " Have you read and understood this? [y/N] " response
- case ${response} in
+ case "${response}" in
[yY][eE][sS]|[yY])
echo ""
return 0
;;
*)
- echo -e "\n ${INFO} Branch change has been cancelled"
+ echo -e "\\n ${INFO} Branch change has been cancelled"
return 1
;;
esac
@@ -218,7 +218,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}" == "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}"
@@ -242,7 +242,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}" == "true" ]]; then
echo ""
echo -e " ${INFO} Web interface"
fetch_checkout_pull_branch "${webInterfaceDir}" "devel" || { echo " ${CROSS} Unable to pull Web development branch"; exit 1; }
@@ -263,7 +263,7 @@ checkout() {
fetch_checkout_pull_branch "${webInterfaceDir}" "master" || { echo " ${CROSS} Unable to pull Web master branch"; exit 1; }
fi
#echo -e " ${TICK} Web Interface"
- get_binary_name
+ get_binary_name
local path
path="master/${binary}"
FTLinstall "${binary}" "${path}"
@@ -276,12 +276,12 @@ checkout() {
fi
corebranches=($(get_available_branches "${PI_HOLE_FILES_DIR}"))
- if [[ "${corebranches[@]}" == *"master"* ]]; then
+ if [[ "${corebranches[*]}" == *"master"* ]]; then
echo -e "${OVER} ${TICK} $str
${INFO} ${#corebranches[@]} branches available for Pi-hole Core"
else
# Print STDERR output from get_available_branches
- echo -e "${OVER} ${CROSS} $str\n\n${corebranches[*]}"
+ echo -e "${OVER} ${CROSS} $str\\n\\n${corebranches[*]}"
exit 1
fi
@@ -303,12 +303,12 @@ checkout() {
fi
webbranches=($(get_available_branches "${webInterfaceDir}"))
- if [[ "${corebranches[@]}" == *"master"* ]]; then
+ if [[ "${webbranches[*]}" == *"master"* ]]; then
echo -e "${OVER} ${TICK} $str
${INFO} ${#webbranches[@]} branches available for Web Admin"
else
# Print STDERR output from get_available_branches
- echo -e "${OVER} ${CROSS} $str\n\n${corebranches[*]}"
+ echo -e "${OVER} ${CROSS} $str\\n\\n${webbranches[*]}"
exit 1
fi
@@ -322,7 +322,6 @@ checkout() {
fi
checkout_pull_branch "${webInterfaceDir}" "${2}"
elif [[ "${1}" == "ftl" ]] ; then
-
get_binary_name
local path
path="${2}/${binary}"
From f2e9d585f79f757302eaf7417f6e7209bc848352 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Sun, 16 Jul 2017 13:22:59 +0100
Subject: [PATCH 090/116] * Add helptext for `pihole checkout ftl` * Only
attempt to install FTL if branch was found * ~~corebranches~~ webbranches
(web branches now actually listed)
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeCheckout.sh | 7 +++----
pihole | 7 ++++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index f9add489..b786ba0c 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -303,12 +303,12 @@ checkout() {
fi
webbranches=($(get_available_branches "${webInterfaceDir}"))
- if [[ "${corebranches[@]}" == *"master"* ]]; then
+ if [[ "${webbranches[@]}" == *"master"* ]]; then
echo -e "${OVER} ${TICK} $str
${INFO} ${#webbranches[@]} branches available for Web Admin"
else
# Print STDERR output from get_available_branches
- echo -e "${OVER} ${CROSS} $str\n\n${corebranches[*]}"
+ echo -e "${OVER} ${CROSS} $str\n\n${webbranches[*]}"
exit 1
fi
@@ -329,12 +329,11 @@ checkout() {
if check_download_exists "$path"; then
echo " ${TICK} Branch ${2} exists"
+ FTLinstall "${binary}" "${path}"
else
echo " ${CROSS} Requested branch \"${2}\" is not available"
fi
- FTLinstall "${binary}" "${path}"
-
else
echo -e " ${INFO} Requested option \"${1}\" is not available"
exit 1
diff --git a/pihole b/pihole
index 1bd35dbb..8da911d8 100755
--- a/pihole
+++ b/pihole
@@ -429,15 +429,15 @@ Time:
# Enable Pi-hole
echo -e " ${INFO} Enabling blocking"
local str="Pi-hole Enabled"
-
+
sed -i 's/^#addn-hosts/addn-hosts/' /etc/dnsmasq.d/01-pihole.conf
if [[ -e "/etc/pihole/wildcard.list" ]]; then
mv "/etc/pihole/wildcard.list" "$wildcardlist"
fi
fi
-
+
restartDNS
-
+
echo -e "${OVER} ${TICK} ${str}"
}
@@ -535,6 +535,7 @@ Switch Pi-hole subsystems to a different Github branch
Repositories:
core [branch] Change the branch of Pi-hole's core subsystem
web [branch] Change the branch of Admin Console subsystem
+ ftl [branch] Change the branch of Pi-hole's FTL subsystem
Branches:
master Update subsystems to the latest stable release
From 247d3ed7299822cad1c3a71a9c999ffd6ff6e8dc Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Sun, 16 Jul 2017 13:54:23 +0100
Subject: [PATCH 091/116] list availible branches for FTL
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeCheckout.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index c6f55dd9..f214d2ce 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -331,6 +331,10 @@ checkout() {
FTLinstall "${binary}" "${path}"
else
echo " ${CROSS} Requested branch \"${2}\" is not available"
+ ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep 'heads' | sed 's/refs\/heads\///;s/ //g' | awk '{print $2}') )
+ echo -e " ${INFO} Available branches for FTL are:"
+ for e in "${ftlbranches[@]}"; do echo " - $e"; done
+ exit 1
fi
else
From c9a98b68c8eff21e997c10f3282686ae820f833f Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Mon, 17 Jul 2017 01:44:14 +1000
Subject: [PATCH 092/116] Avoid reactivating a deactivated lighttpd service
(#1485)
* Do not activate disabled lighttpd upon update
* Fixes #1362
* Use systemctl when available
* Move `finalexports` to the very end of the install script
set value of LIGHTTPD_ENABLED to 1 or 0 depending on whether or not lighttpd is enabled or disabled.
actually save LIGHTTPD_ENABLED value to setupvars.conf
Signed-off-by: Adam Warner
* add [[ -z "${LIGHTTPD_ENABLED}" ]] back in!
Signed-off-by: Adam Warner
* Ensure "Loaded:" is the line being checked
* Colourise disabled lighttpd message
* Prevent disabled lighttpd triggering error
* change of plan, don't need that [[ -z "${LIGHTTPD_ENABLED}" ]]
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 35 ++++++++++++++++++++----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 74e2a61d..a3c41b11 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1485,8 +1485,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;' "${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/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
fi
# echo the information to the user
{
@@ -1497,6 +1496,7 @@ finalExports() {
echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}"
echo "QUERY_LOGGING=${QUERY_LOGGING}"
echo "INSTALL_WEB=${INSTALL_WEB}"
+ echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
}>> "${setupVars}"
# Look for DNS server settings which would have to be reapplied
@@ -1585,9 +1585,6 @@ installPihole() {
FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
# Configure the firewall
configureFirewall
- # Run the final exports
- finalExports
- #runGravity
}
# At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break.
@@ -1621,8 +1618,8 @@ updatePihole() {
installLogrotate
# Detect if FTL is installed
FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
- finalExports #re-export setupVars.conf to account for any new vars added in new versions
- #runGravity
+
+
}
@@ -2052,10 +2049,24 @@ main() {
enable_service dnsmasq
# If the Web server was installed,
- if [[ ${INSTALL_WEB} == true ]]; then
- # enable it
- start_service lighttpd
- enable_service lighttpd
+ if [[ "${INSTALL_WEB}" == true ]]; then
+ # Check to see if lighttpd was already set to run on reboot
+ if [[ "${useUpdateVars}" == true ]]; then
+ 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
+ fi
+
+ if [[ "${LIGHTTPD_ENABLED}" == "1" ]]; then
+ start_service lighttpd
+ enable_service lighttpd
+ else
+ echo -e " ${INFO} Lighttpd is disabled, skipping service restart"
+ fi
fi
# Download and compile the aggregated block list
@@ -2103,6 +2114,8 @@ main() {
# Display where the log file is
echo -e "\n ${INFO} The install log is located at: /etc/pihole/install.log
${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}"
+ #update setupvars.conf with any variables that may or may not have been changed during the install
+ finalExports
}
#
From 70fb733fea71858494f441d429513d6a77674b21 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 17 Jul 2017 10:53:49 +0100
Subject: [PATCH 093/116] col_table does not exist yet, will break the install
if pushed as hotfix. Not sure why these additional "'s were put in, they
break the update command, too.
Signed-off-by: Adam Warner
---
advanced/Scripts/update.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index e3a7f8fd..2ef136a9 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -26,8 +26,6 @@ PH_TEST=true
#shellcheck disable=SC1090
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
-source "/opt/pihole/COL_TABLE"
-
# is_repo() sourced from basic-install.sh
# make_repo() sourced from basic-install.sh
# update_repo() source from basic-install.sh
@@ -43,7 +41,7 @@ GitCheckUpdateAvail() {
# @ alone is a shortcut for HEAD. Older versions of git
# need @{0}
- LOCAL="$("git rev-parse @{0}")"
+ LOCAL="$(git rev-parse @{0})"
# The suffix @{upstream} to a branchname
# (short form @{u}) refers
@@ -52,7 +50,7 @@ GitCheckUpdateAvail() {
# (configured with branch..remote and
# branch..merge). A missing branchname
# defaults to the current one.
- REMOTE="$("git rev-parse @{upstream}")"
+ REMOTE="$(git rev-parse @{upstream})"
if [[ ${#LOCAL} == 0 ]]; then
echo "::: Error: Local revision could not be obtained, ask Pi-hole support."
From 83592a5e70a627ea1ba5ab1fce6c99112e9e8f6b Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 17 Jul 2017 11:14:02 +0100
Subject: [PATCH 094/116] Put '"'s in the right place
Signed-off-by: Adam Warner
---
advanced/Scripts/update.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index 2ef136a9..4281d69f 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -41,7 +41,7 @@ GitCheckUpdateAvail() {
# @ alone is a shortcut for HEAD. Older versions of git
# need @{0}
- LOCAL="$(git rev-parse @{0})"
+ LOCAL="$(git rev-parse "@{0}")"
# The suffix @{upstream} to a branchname
# (short form @{u}) refers
@@ -50,7 +50,7 @@ GitCheckUpdateAvail() {
# (configured with branch..remote and
# branch..merge). A missing branchname
# defaults to the current one.
- REMOTE="$(git rev-parse @{upstream})"
+ REMOTE="$(git rev-parse "@{upstream}")"
if [[ ${#LOCAL} == 0 ]]; then
echo "::: Error: Local revision could not be obtained, ask Pi-hole support."
From 2ccf063dfeb2606bdd34c224b7967efb59487b7d Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sat, 22 Jul 2017 15:15:39 +1000
Subject: [PATCH 095/116] Update Issue Template text
---
.github/ISSUE_TEMPLATE.md | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 23e67795..185539ec 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,33 +1,36 @@
-**In raising this issue, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your issue:**
+**In raising this issue, I confirm the following:** `{please fill the checkboxes, e.g: [X]}`
- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
-- [] The issue I am reporting can be *replicated*
+- [] The issue I am reporting can be *replicated*.
- [] The issue I am reporting isn't a duplicate (see [FAQs](https://github.com/pi-hole/pi-hole/wiki/FAQs), [closed issues](https://github.com/pi-hole/pi-hole/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), and [open issues](https://github.com/pi-hole/pi-hole/issues)).
-**How familiar are you with the codebase?:**
+**How familiar are you with the the source code relevant to this issue?:**
-_{replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}_
+`{Replace this with a number from 1 to 10. 1 being not familiar, and 10 being very familiar}`
---
-**[BUG REPORT | OTHER]:**
+**Expected behaviour:**
-Please [submit your feature request here](https://discourse.pi-hole.net/c/feature-requests), so it is votable by the community. It's also easier for us to track.
+`{A detailed description of what you expect to see}`
-**[BUG | ISSUE] Expected Behaviour:**
+**Actual behaviour:**
+`{A detailed description and/or screenshots of what you do see}`
-**[BUG | ISSUE] Actual Behaviour:**
+**Steps to reproduce:**
+`{Detailed steps of how we can reproduce this}`
-**[BUG | ISSUE] Steps to reproduce:**
+**Debug token provided by [uploading `pihole -d` log](https://pi-hole.net/2016/11/07/crack-our-medical-tricorder-win-a-raspberry-pi-3/):**
--
--
--
--
+`{Alphanumeric token}`
-**(Optional) Debug token generated by `pihole -d`:**
+**Troubleshooting undertaken, and/or other relevant information:**
-``
+`{Steps of what you have done to fix this}`
-_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
+> * `{Please delete this quoted section when opening your issue}`
+> * You must follow the template instructions. Failure to do so will result in your issue being closed.
+> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
+> * Detail helps us understand and resolve an issue quicker, but please ensure it's relevant.
+> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
From 291c111ce8fd3f056bc5c5fef3e7b86e836448cf Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sat, 22 Jul 2017 15:29:36 +1000
Subject: [PATCH 096/116] Update PR Template text
Signed-off-by: WaLLy3K
---
.github/PULL_REQUEST_TEMPLATE.md | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 8583806b..aefe5bea 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,19 +1,32 @@
-**By submitting this pull request, I confirm the following (please check boxes, eg [X]) _Failure to fill the template will close your PR_:**
+**By submitting this pull request, I confirm the following:** `{please fill the checkboxes, e.g: [X]}`
-***Please submit all pull requests against the `development` branch. Failure to do so will delay or deny your request***
+`{Please ensure that your pull request is for the 'development' branch!}`
- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
-- [] I have written tests and verified that they fail without my change.
+- [] I have performed relevant testing to verify that they work with my change.
- [] I have squashed any insignificant commits.
- [] This change has comments for package types, values, functions, and non-obvious lines of code.
- [] I am willing to help maintain this change if there are issues with it later.
-- [] I give this submission freely and claim no ownership. It is compatible with the EUPL 1.2 license.
-- [] I have Signed Off all commits. (`git commit --signoff`)
+- [] I give this submission freely and claim no ownership.
+- [] It is compatible with the EUPL 1.2 license.
+- [] I have Signed Off all commits. ([`git commit --signoff`](https://git-scm.com/docs/git-commit#git-commit---signoff))
-***Please explain what you have done and wish to accomplish with this Pull Request***
+---
-1. What does this change do, exactly?
+**What does this PR aim to fix?:**
-2. Please link to the relevant issues.
+`{A detailed description and/or screenshots of the issue, and links to any relevant GitHub issues}`
-3. Which documentation changes (if any) need to be made because of this PR?
+**How does this PR fix the issue?:**
+
+`{A detailed description and/or screenshots of the implemented fix}`
+
+**What documentation changes (if any) are needed to support this PR?:**
+
+`{A detailed list of any necessary changes}`
+
+> * `{Please delete this quoted section when opening your pull request}`
+> * You must follow the template instructions. Failure to do so will result in your issue being closed.
+> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
+> * Detail helps us understand an issue quicker, but please ensure it's relevant.
+> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._'
From eead2f059b5dc14662b5179aee08b0bc448815cb Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sun, 23 Jul 2017 11:06:43 +1000
Subject: [PATCH 097/116] Add review suggestions to Issue Template
* Use a more relevant link when explaining debug
* Re-add feature request note
---
.github/ISSUE_TEMPLATE.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 185539ec..4a9c585a 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -21,7 +21,7 @@
`{Detailed steps of how we can reproduce this}`
-**Debug token provided by [uploading `pihole -d` log](https://pi-hole.net/2016/11/07/crack-our-medical-tricorder-win-a-raspberry-pi-3/):**
+**Debug token provided by [uploading `pihole -d` log](https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#debug):**
`{Alphanumeric token}`
@@ -31,6 +31,7 @@
> * `{Please delete this quoted section when opening your issue}`
> * You must follow the template instructions. Failure to do so will result in your issue being closed.
+> * Please [submit any feature requests here](https://discourse.pi-hole.net/c/feature-requests), so it is votable and trackable by the community.
> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
> * Detail helps us understand and resolve an issue quicker, but please ensure it's relevant.
> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
From 1c93868ae1b1bc673f26ae4c5a9d235897ca99aa Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Mon, 24 Jul 2017 23:22:04 +0100
Subject: [PATCH 098/116] Adjust wording of echos
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 3a53fca5..f0d6018f 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1882,6 +1882,7 @@ FTLdetect() {
#In the next section we check to see if FTL is already installed (in case of pihole -r).
#If the installed version matches the latest version, then check the installed sha1sum of the binary vs the remote sha1sum. If they do not match, then download
+ echo -e " ${INFO} Checking for existing FTL binary..."
local FTLversion=$(/usr/bin/pihole-FTL tag)
local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
@@ -1889,15 +1890,16 @@ FTLdetect() {
# Install FTL
FTLinstall "${binary}" || return 1
else
+ echo -e " ${INFO} Latest FTL Binary already installed (${FTLlatesttag}). Confirming Checksum..."
+
local remoteSha1=$(curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1" | cut -d ' ' -f 1)
local localSha1=$(sha1sum "$(which pihole-FTL)" | cut -d ' ' -f 1)
- echo -e " ${INFO} Existing FTL Binary detected. Checking sha1sum..."
if [[ "${remoteSha1}" != "${localSha1}" ]]; then
echo -e " ${INFO} Corruption detected..."
FTLinstall "${binary}" || return 1
else
- echo -e " ${INFO} sha1sums match. No need to download!"
+ echo -e " ${INFO} Checksum correct. No need to download!"
fi
fi
}
From a293b5a3718f3381f9f9fd2cc955127d062e1a99 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Tue, 25 Jul 2017 22:49:06 +0100
Subject: [PATCH 099/116] prevent `./automated install/basic-install.sh: line
1886: /usr/bin/pihole-FTL: No such file or directory` on new install, or if
pihole-FTL is missing for whatever reason.
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 38 +++++++++++++++++++-----------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index f0d6018f..170754f2 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1883,25 +1883,35 @@ FTLdetect() {
#In the next section we check to see if FTL is already installed (in case of pihole -r).
#If the installed version matches the latest version, then check the installed sha1sum of the binary vs the remote sha1sum. If they do not match, then download
echo -e " ${INFO} Checking for existing FTL binary..."
- local FTLversion=$(/usr/bin/pihole-FTL tag)
- local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
- if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
- # Install FTL
- FTLinstall "${binary}" || return 1
- else
- echo -e " ${INFO} Latest FTL Binary already installed (${FTLlatesttag}). Confirming Checksum..."
+ local ftlLoc=$(which pihole-FTL)
- local remoteSha1=$(curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1" | cut -d ' ' -f 1)
- local localSha1=$(sha1sum "$(which pihole-FTL)" | cut -d ' ' -f 1)
+ if [[ ${ftlLoc} ]]; then
+ local FTLversion=$(/usr/bin/pihole-FTL tag)
+ local FTLlatesttag=$(curl -sI https://github.com/pi-hole/FTL/releases/latest | grep 'Location' | awk -F '/' '{print $NF}' | tr -d '\r\n')
- if [[ "${remoteSha1}" != "${localSha1}" ]]; then
- echo -e " ${INFO} Corruption detected..."
- FTLinstall "${binary}" || return 1
+ if [[ "${FTLversion}" != "${FTLlatesttag}" ]]; then
+ # Install FTL
+ FTLinstall "${binary}" || return 1
else
- echo -e " ${INFO} Checksum correct. No need to download!"
+ echo -e " ${INFO} Latest FTL Binary already installed (${FTLlatesttag}). Confirming Checksum..."
+
+ local remoteSha1=$(curl -sSL --fail "https://github.com/pi-hole/FTL/releases/download/${FTLversion%$'\r'}/${binary}.sha1" | cut -d ' ' -f 1)
+ local localSha1=$(sha1sum "$(which pihole-FTL)" | cut -d ' ' -f 1)
+
+ if [[ "${remoteSha1}" != "${localSha1}" ]]; then
+ echo -e " ${INFO} Corruption detected..."
+ FTLinstall "${binary}" || return 1
+ else
+ echo -e " ${INFO} Checksum correct. No need to download!"
+ fi
fi
- fi
+ else
+ # Install FTL
+ FTLinstall "${binary}" || return 1
+ fi
+
+
}
main() {
From 714fd93292880e999706419480f4c59a0defb77f Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Wed, 26 Jul 2017 08:03:23 +1000
Subject: [PATCH 100/116] Provide correct FTL stats (#1619)
* Provide correct FTL stats
* Use the correct lines in the array when displaying FTL stats
* Treat ads_blocked_today/dns_queries_today as currency, like domains_being_blocked is on large screens
* Chronometer Shellcheck validation
* Remove unnecessary \ from CPU usage readout
---
advanced/Scripts/chronometer.sh | 42 ++++++++++++++++++---------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh
index d9b01fc0..a9ccf900 100755
--- a/advanced/Scripts/chronometer.sh
+++ b/advanced/Scripts/chronometer.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1090,SC1091
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
@@ -91,10 +92,10 @@ printFunc() {
printf "%s%s$spc" "$title" "$text_main"
if [[ -n "$text_addn" ]]; then
- printf "%s(%s)%s\n" "$COL_NC$COL_DARK_GRAY" "$text_addn" "$COL_NC"
+ printf "%s(%s)%s\\n" "$COL_NC$COL_DARK_GRAY" "$text_addn" "$COL_NC"
else
# Do not print trailing newline on final line
- [[ -z "$text_last" ]] && printf "%s\n" "$COL_NC"
+ [[ -z "$text_last" ]] && printf "%s\\n" "$COL_NC"
fi
}
@@ -126,7 +127,7 @@ get_init_stats() {
mins=$(( ($1%3600)/60 )); secs=$(( $1%60 ))
[[ "$day" -ge "2" ]] && plu="s"
[[ "$day" -ge "1" ]] && days="$day day${plu}, " || days=""
- printf "%s%02d:%02d:%02d\n" "$days" "$hrs" "$mins" "$secs"
+ printf "%s%02d:%02d:%02d\\n" "$days" "$hrs" "$mins" "$secs"
}
# Set Colour Codes
@@ -285,6 +286,7 @@ get_sys_stats() {
sys_loadavg=$(cut -d " " -f1,2,3 /proc/loadavg)
# Get CPU usage, only counting processes over 1% as active
+ # shellcheck disable=SC2009
cpu_raw=$(ps -eo pcpu,rss --no-headers | grep -E -v " 0")
cpu_tasks=$(wc -l <<< "$cpu_raw")
cpu_taskact=$(sed -r "/(^ 0.)/d" <<< "$cpu_raw" | wc -l)
@@ -306,7 +308,7 @@ get_sys_stats() {
# Determine colour for temperature
if [[ -n "$temp_file" ]]; then
if [[ "$temp_unit" == "C" ]]; then
- cpu_temp=$(printf "%.0fc\n" "$(calcFunc "$(< $temp_file) / 1000")")
+ cpu_temp=$(printf "%.0fc\\n" "$(calcFunc "$(< $temp_file) / 1000")")
case "${cpu_temp::-1}" in
-*|[0-9]|[1-3][0-9]) cpu_col="$COL_LIGHT_BLUE";;
@@ -320,7 +322,7 @@ get_sys_stats() {
cpu_temp_str=" @ $cpu_col$cpu_temp$COL_NC$COL_DARK_GRAY"
elif [[ "$temp_unit" == "F" ]]; then
- cpu_temp=$(printf "%.0ff\n" "$(calcFunc "($(< $temp_file) / 1000) * 9 / 5 + 32")")
+ cpu_temp=$(printf "%.0ff\\n" "$(calcFunc "($(< $temp_file) / 1000) * 9 / 5 + 32")")
case "${cpu_temp::-1}" in
-*|[0-9]|[0-9][0-9]) cpu_col="$COL_LIGHT_BLUE";;
@@ -333,7 +335,7 @@ get_sys_stats() {
cpu_temp_str=" @ $cpu_col$cpu_temp$COL_NC$COL_DARK_GRAY"
else
- cpu_temp_str=$(printf " @ %.0fk\n" "$(calcFunc "($(< $temp_file) / 1000) + 273.15")")
+ cpu_temp_str=$(printf " @ %.0fk\\n" "$(calcFunc "($(< $temp_file) / 1000) + 273.15")")
fi
else
cpu_temp_str=""
@@ -365,12 +367,12 @@ get_ftl_stats() {
local stats_raw
mapfile -t stats_raw < <(pihole-FTL "stats")
- domains_being_blocked_raw="${stats_raw[1]#* }"
- dns_queries_today_raw="${stats_raw[3]#* }"
- ads_blocked_today_raw="${stats_raw[5]#* }"
- ads_percentage_today_raw="${stats_raw[7]#* }"
- queries_forwarded_raw="${stats_raw[11]#* }"
- queries_cached_raw="${stats_raw[13]#* }"
+ domains_being_blocked_raw="${stats_raw[0]#* }"
+ dns_queries_today_raw="${stats_raw[1]#* }"
+ ads_blocked_today_raw="${stats_raw[2]#* }"
+ ads_percentage_today_raw="${stats_raw[3]#* }"
+ queries_forwarded_raw="${stats_raw[5]#* }"
+ queries_cached_raw="${stats_raw[6]#* }"
# Only retrieve these stats when not called from jsonFunc
if [[ -z "$1" ]]; then
@@ -378,11 +380,11 @@ get_ftl_stats() {
local top_domain_raw
local top_client_raw
- domains_being_blocked=$(printf "%.0f\n" "${domains_being_blocked_raw}")
- dns_queries_today=$(printf "%.0f\n" "${dns_queries_today_raw}")
- ads_blocked_today=$(printf "%.0f\n" "${ads_blocked_today_raw}")
- ads_percentage_today=$(printf "%'.0f\n" "${ads_percentage_today_raw}")
- queries_cached_percentage=$(printf "%.0f\n" "$(calcFunc "$queries_cached_raw * 100 / ( $queries_forwarded_raw + $queries_cached_raw )")")
+ domains_being_blocked=$(printf "%.0f\\n" "${domains_being_blocked_raw}")
+ dns_queries_today=$(printf "%.0f\\n" "${dns_queries_today_raw}")
+ ads_blocked_today=$(printf "%.0f\\n" "${ads_blocked_today_raw}")
+ ads_percentage_today=$(printf "%'.0f\\n" "${ads_percentage_today_raw}")
+ queries_cached_percentage=$(printf "%.0f\\n" "$(calcFunc "$queries_cached_raw * 100 / ( $queries_forwarded_raw + $queries_cached_raw )")")
recent_blocked=$(pihole-FTL recentBlocked)
read -r -a top_ad_raw <<< "$(pihole-FTL "top-ads (1)")"
read -r -a top_domain_raw <<< "$(pihole-FTL "top-domains (1)")"
@@ -412,6 +414,8 @@ get_strings() {
used_str="Used: "
leased_str="Leased: "
domains_being_blocked=$(printf "%'.0f" "$domains_being_blocked")
+ ads_blocked_today=$(printf "%'.0f" "$ads_blocked_today")
+ dns_queries_today=$(printf "%'.0f" "$dns_queries_today")
ph_info="Blocking: $domains_being_blocked sites"
total_str="Total: "
else
@@ -473,8 +477,8 @@ chronoFunc() {
${COL_DARK_GRAY}$scr_line_str${COL_NC}"
else
echo -e "[0;1;31;91m|¯[0;1;33;93m¯[0;1;32;92m¯[0;1;32;92m(¯[0;1;36;96m)[0;1;34;94m_[0;1;35;95m|[0;1;33;93m¯[0;1;31;91m|_ [0;1;32;92m__[0;1;36;96m_|[0;1;31;91m¯[0;1;34;94m|[0;1;35;95m__[0;1;31;91m_[0m$phc_ver_str
-[0;1;33;93m| ¯[0;1;32;92m_[0;1;36;96m/¯[0;1;34;94m|[0;1;35;95m_[0;1;31;91m| [0;1;33;93m' [0;1;32;92m\/ [0;1;36;96m_ [0;1;34;94m\ [0;1;35;95m/ [0;1;31;91m-[0;1;33;93m_)[0m$lte_ver_str
-[0;1;32;92m|_[0;1;36;96m| [0;1;34;94m|_[0;1;35;95m| [0;1;33;93m|_[0;1;32;92m||[0;1;36;96m_\[0;1;34;94m__[0;1;35;95m_/[0;1;31;91m_\[0;1;33;93m__[0;1;32;92m_|[0m$ftl_ver_str
+[0;1;33;93m| ¯[0;1;32;92m_[0;1;36;96m/¯[0;1;34;94m|[0;1;35;95m_[0;1;31;91m| [0;1;33;93m' [0;1;32;92m\\/ [0;1;36;96m_ [0;1;34;94m\\ [0;1;35;95m/ [0;1;31;91m-[0;1;33;93m_)[0m$lte_ver_str
+[0;1;32;92m|_[0;1;36;96m| [0;1;34;94m|_[0;1;35;95m| [0;1;33;93m|_[0;1;32;92m||[0;1;36;96m_\\[0;1;34;94m__[0;1;35;95m_/[0;1;31;91m_\\[0;1;33;93m__[0;1;32;92m_|[0m$ftl_ver_str
${COL_DARK_GRAY}$scr_line_str${COL_NC}"
fi
From e0eb5eb2b1bb5fc5772aac479f71d4dfb77237ac Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Wed, 26 Jul 2017 08:07:06 +1000
Subject: [PATCH 101/116] Fix queryFunc if adlists URLs have been removed
(#1618)
* Fix queryFunc if adlists URLs have been removed
* Allow for -adlists command line switch (where the "s" is a typo)
* Add error message when unable to find associated adlists URL
* Provide PR fix on current dev version
* Add blResult variable for white/black match
* Supporting Block Page queryFunc fixes
* Re-add unmerged lines
---
pihole | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/pihole b/pihole
index 8da911d8..61ed6cd6 100755
--- a/pihole
+++ b/pihole
@@ -149,7 +149,7 @@ Options:
fi
# Strip valid options, leaving only the domain and invalid options
- options=$(sed 's/ \?-\(exact\|adlist\|bp\|all\) \?//g' <<< "$options")
+ options=$(sed 's/ \?-\(exact\|adlist\(s\)\?\|bp\|all\) \?//g' <<< "$options")
# Handle errors
if [[ "${options}" == *" "* ]]; then
@@ -181,13 +181,14 @@ Options:
results=($(scanList "${query}" "${lists}" "${method}"))
if [[ -n "${results[*]}" ]]; then
+ blResult=true
# Loop through each scanList line to print appropriate title
for result in "${results[@]}"; do
filename="${result/:*/}"
if [[ -n "$exact" ]]; then
printf " Exact result in %s\n" "${filename}"
elif [[ -n "$blockpage" ]]; then
- printf " [i] %s\n" "${filename}"
+ printf "π %s\n" "${filename}"
else
domain="${result/*:/}"
if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
@@ -216,7 +217,7 @@ Options:
fi
if [[ -n "${blockpage}" ]]; then
- echo " ${INFO} ${match}"
+ echo "π ${wildcardlist/*\/}"
else
echo " *.${match}"
fi
@@ -287,12 +288,18 @@ Options:
filenum=("${filename/list./}")
filenum=("${filenum/.*/}")
filename="${adlists[$filenum]}"
+
+ # If gravity has generated associated .domains files
+ # but adlists.list has been modified since
+ if [[ -z "${filename}" ]]; then
+ filename="${COL_LIGHT_RED}Error: no associated adlists URL found${COL_NC}"
+ fi
fi
if [[ -n "${exact}" ]]; then
printf " %s\n" "${filename}"
elif [[ -n "${blockpage}" ]]; then
- printf " [%s] %s\n" "${filenum}" "${filename}"
+ printf "%s %s\n" "${filenum}" "${filename}"
else # Standard query output
# Print filename heading once per file, not for every match
From c02a24cf7176f73c8ec8d1abf28a807e69611c17 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Wed, 26 Jul 2017 14:34:40 +0100
Subject: [PATCH 102/116] Fix/unbreak development (#1635)
* Always process DNS and DHCP settings in installer
* change where finalExports is called and where LIGHTTPD_ENABLED is set.
Signed-off-by: Adam Warner
* this may or may not work. If it does, can be functionised to reduce code duping
Signed-off-by: Adam Warner
* This will fix the tests, but break the patch
Signed-off-by: Adam Warner
---
automated install/basic-install.sh | 43 +++++++++++++++++-------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 4330637d..e37282a7 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1499,22 +1499,20 @@ finalExports() {
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
}>> "${setupVars}"
- # Look for DNS server settings which would have to be reapplied
+ # Bring in the current settings and the functions to manipulate them
source "${setupVars}"
- #
source "${PI_HOLE_LOCAL_REPO}/advanced/Scripts/webpage.sh"
- #
if [[ "${DNS_FQDN_REQUIRED}" != "" ]] ; then
- #
+ # Look for DNS server settings which would have to be reapplied
ProcessDNSSettings
fi
- #
if [[ "${DHCP_ACTIVE}" != "" ]] ; then
- #
+ # Look for DHCP server settings which would have to be reapplied
ProcessDHCPSettings
fi
+
}
# Install the logrotate script
@@ -1585,6 +1583,9 @@ installPihole() {
FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
# Configure the firewall
configureFirewall
+
+ #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.
@@ -1619,6 +1620,8 @@ updatePihole() {
# 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
}
@@ -2034,6 +2037,13 @@ main() {
fi
install_dependent_packages DEPS[@]
+ 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 ${tmpLog}
@@ -2055,6 +2065,14 @@ main() {
fi
install_dependent_packages DEPS[@]
+ 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 ${tmpLog}
fi
@@ -2080,16 +2098,6 @@ main() {
# If the Web server was installed,
if [[ "${INSTALL_WEB}" == true ]]; then
- # Check to see if lighttpd was already set to run on reboot
- if [[ "${useUpdateVars}" == true ]]; then
- 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
- fi
if [[ "${LIGHTTPD_ENABLED}" == "1" ]]; then
start_service lighttpd
@@ -2144,8 +2152,7 @@ main() {
# Display where the log file is
echo -e "\n ${INFO} The install log is located at: /etc/pihole/install.log
${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}"
- #update setupvars.conf with any variables that may or may not have been changed during the install
- finalExports
+
}
#
From b09c660833b322eec21a1f84e1044557c274478a Mon Sep 17 00:00:00 2001
From: Mcat12
Date: Wed, 26 Jul 2017 12:15:23 -0400
Subject: [PATCH 103/116] Always process DNS and DHCP settings in installer
(#1630)
* Always process DNS and DHCP settings in installer
* Make sure dnsmasq config exists before modifying it
Signed-off-by: Mcat12
* Make sure the dnsmasq config directory exists
Signed-off-by: Mcat12
* Only remove the DHCP config if it exists (fixes tests, hopefully)
Signed-off-by: Mcat12
---
advanced/Scripts/webpage.sh | 4 +++-
automated install/basic-install.sh | 11 +++--------
test/test_automated_install.py | 2 ++
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index 42272122..b887a2b8 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -292,7 +292,9 @@ ra-param=*,0,0
fi
else
- rm "${dhcpconfig}" &> /dev/null
+ if [[ -f "${dhcpconfig}" ]]; then
+ rm "${dhcpconfig}" &> /dev/null
+ fi
fi
}
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index e37282a7..9d264846 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1503,16 +1503,11 @@ finalExports() {
source "${setupVars}"
source "${PI_HOLE_LOCAL_REPO}/advanced/Scripts/webpage.sh"
- if [[ "${DNS_FQDN_REQUIRED}" != "" ]] ; then
# Look for DNS server settings which would have to be reapplied
- ProcessDNSSettings
- fi
-
- if [[ "${DHCP_ACTIVE}" != "" ]] ; then
- # Look for DHCP server settings which would have to be reapplied
- ProcessDHCPSettings
- fi
+ ProcessDNSSettings
+ # Look for DHCP server settings which would have to be reapplied
+ ProcessDHCPSettings
}
# Install the logrotate script
diff --git a/test/test_automated_install.py b/test/test_automated_install.py
index 4a4f72aa..9129c314 100644
--- a/test/test_automated_install.py
+++ b/test/test_automated_install.py
@@ -59,6 +59,8 @@ def test_setupVars_saved_to_file(Pihole):
TERM=xterm
source /opt/pihole/basic-install.sh
{}
+ mkdir -p /etc/dnsmasq.d
+ version_check_dnsmasq
finalExports
cat /etc/pihole/setupVars.conf
'''.format(set_setup_vars))
From fdf2649f2fef8981176735fb856997e4856fc13b Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Thu, 27 Jul 2017 03:00:08 +1000
Subject: [PATCH 104/116] Clean up known remaining colour output issues (#1613)
* Print newline on error message
* Output last three lines of error if update fails
* Consistent error messages & housekeeping
* Add shellcheck directive to ignore COL_TABLE
* Quoted and braced variables for codebase consistency
* Escaped newlines correctly
* Made error messages consistent (indenting and wording)
* Removed consecutive echos
* Conditional formatting consistency
* Braced, quoted and used [[ on conditionals
* Fix specific ShellCheck issues
* Fixed issues that could be safely changed without extensive testing
* Update SELinux whiptail behaviour & more
* Colourised some strings
* Fixed multiple line string indenting
* Made output consistent with existing codebase
* Removed sequential echos
* Make SELinux whiptail use "--defaultno", and change text wording
* Add help text for hostrecord, and colourise output
* this should fix the tests...
Signed-off-by: Adam Warner
* revert changes to `update_package_cache()` to prove tests
Signed-off-by: Adam Warner
---
advanced/Scripts/update.sh | 76 ++++----
advanced/Scripts/webpage.sh | 20 +-
automated install/basic-install.sh | 283 ++++++++++++++---------------
test/test_automated_install.py | 6 +-
4 files changed, 194 insertions(+), 191 deletions(-)
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index 71b7cecd..a4ada4c8 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -19,10 +19,9 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
# shellcheck disable=SC2034
PH_TEST=true
-# Have to ignore the following rule as spaces in paths are not supported by ShellCheck
-#shellcheck disable=SC1090
+# shellcheck disable=SC1090
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
-
+# shellcheck disable=SC1091
source "/opt/pihole/COL_TABLE"
# is_repo() sourced from basic-install.sh
@@ -51,15 +50,15 @@ GitCheckUpdateAvail() {
# defaults to the current one.
REMOTE="$(git rev-parse "@{upstream}")"
- if [[ ${#LOCAL} == 0 ]]; then
- echo -e " ${COL_LIGHT_RED}Error: Local revision could not be obtained, ask Pi-hole support."
- echo -e " Additional debugging output:${COL_NC}"
+ if [[ "${#LOCAL}" == 0 ]]; then
+ echo -e "\\n ${COL_LIGHT_RED}Error: Local revision could not be obtained, please contact Pi-hole Support
+ Additional debugging output:${COL_NC}"
git status
exit
fi
- if [[ ${#REMOTE} == 0 ]]; then
- echo -e " ${COL_LIGHT_RED}Error: Remote revision could not be obtained, ask Pi-hole support."
- echo -e " Additional debugging output:${COL_NC}"
+ if [[ "${#REMOTE}" == 0 ]]; then
+ echo -e "\\n ${COL_LIGHT_RED}Error: Remote revision could not be obtained, please contact Pi-hole Support
+ Additional debugging output:${COL_NC}"
git status
exit
fi
@@ -94,13 +93,15 @@ FTLcheckUpdate() {
main() {
local pihole_version_current
local web_version_current
- #shellcheck disable=1090,2154
+ local basicError="\\n ${COL_LIGHT_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
+
+ # shellcheck disable=1090,2154
source "${setupVars}"
- #This is unlikely
+ # This is unlikely
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
- echo -e " ${COL_LIGHT_RED}Critical Error: Core Pi-hole repo is missing from system!"
- echo -e " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
+ echo -e "\\n ${COL_LIGHT_RED}Error: Core Pi-hole repo is missing from system!
+ Please re-run install script from https://pi-hole.net${COL_NC}"
exit 1;
fi
@@ -108,18 +109,18 @@ main() {
if GitCheckUpdateAvail "${PI_HOLE_FILES_DIR}" ; then
core_update=true
- echo -e " ${INFO} Pi-hole Core:\t${COL_YELLOW}update available${COL_NC}"
+ echo -e " ${INFO} Pi-hole Core:\\t${COL_YELLOW}update available${COL_NC}"
else
core_update=false
- echo -e " ${INFO} Pi-hole Core:\t${COL_LIGHT_GREEN}up to date${COL_NC}"
+ 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}"
+ 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}"
+ 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
@@ -132,19 +133,19 @@ main() {
echo ""
fi
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
- echo -e " ${COL_LIGHT_RED}Critical Error: Web Admin repo is missing from system!"
- echo -e " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
+ 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}"
exit 1;
fi
if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}" ; then
web_update=true
- echo -e " ${INFO} Web Interface:\t${COL_YELLOW}update available${COL_NC}"
+ echo -e " ${INFO} Web Interface:\\t${COL_YELLOW}update available${COL_NC}"
else
web_update=false
- echo -e " ${INFO} Web Interface:\t${COL_LIGHT_GREEN}up to date${COL_NC}"
+ echo -e " ${INFO} Web Interface:\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
fi
# Logic
@@ -163,25 +164,24 @@ main() {
echo -e " ${TICK} Everything is up to date!"
exit 0
fi
-
elif ! ${core_update} && ${web_update} ; then
echo ""
echo -e " ${INFO} Pi-hole Web Admin files out of date"
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
-
elif ${core_update} && ! ${web_update} ; then
echo ""
echo -e " ${INFO} Pi-hole core files out of date"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
- ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo -e " ${COL_LIGHT_RED}Unable to complete update, contact Pi-hole${COL_NC}" && exit 1
-
+ ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \
+ echo -e "${basicError}" && exit 1
elif ${core_update} && ${web_update} ; then
echo ""
echo -e " ${INFO} Updating Pi-hole core and web admin files"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
- ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || echo -e " ${COL_LIGHT_RED}Unable to complete update, contact Pi-hole${COL_NC}" && exit 1
+ ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --unattended || \
+ echo -e "${basicError}" && exit 1
else
- echo -e " ${COL_LIGHT_RED}Update script has malfunctioned, fallthrough reached. Please contact support${COL_NC}"
+ echo -e " ${COL_LIGHT_RED}Update script has malfunctioned, please contact Pi-hole Support${COL_NC}"
exit 1
fi
else # Web Admin not installed, so only verify if core is up to date
@@ -193,38 +193,36 @@ main() {
fi
else
echo ""
- echo -e " ${INFO} Pi-hole core files out of date"
+ echo -e " ${INFO} Pi-hole Core files out of date"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
- ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || echo -e " ${COL_LIGHT_RED}Unable to complete update, contact Pi-hole${COL_NC}" && exit 1
+ ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \
+ echo -e "${basicError}" && exit 1
fi
fi
if [[ "${web_update}" == true ]]; then
web_version_current="$(/usr/local/bin/pihole version --admin --current)"
echo ""
- echo -e " ${INFO} Web Admin version is now at ${web_version_current/* v/v}"
- echo -e " ${INFO} If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'"
+ echo -e " ${INFO} Web Admin version is now at ${web_version_current/* v/v}
+ ${INFO} If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'"
fi
if [[ "${core_update}" == true ]]; then
pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)"
echo ""
- echo -e " ${INFO} Pi-hole version is now at ${pihole_version_current/* v/v}"
- echo -e " ${INFO} If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'"
+ echo -e " ${INFO} Pi-hole version is now at ${pihole_version_current/* v/v}
+ ${INFO} If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'"
fi
- if [[ ${FTL_update} == true ]]; then
+ if [[ "${FTL_update}" == true ]]; then
FTL_version_current="$(/usr/bin/pihole-FTL tag)"
- echo ""
- echo -e " ${INFO} FTL version is now at ${FTL_version_current/* v/v}"
+ echo -e "\\n ${INFO} FTL version is now at ${FTL_version_current/* v/v}"
start_service pihole-FTL
enable_service pihole-FTL
fi
-
echo ""
exit 0
-
}
main
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index b887a2b8..9d101482 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -29,6 +29,7 @@ Options:
-c, celsius Set Celsius as preferred temperature unit
-f, fahrenheit Set Fahrenheit as preferred temperature unit
-k, kelvin Set Kelvin as preferred temperature unit
+ -r, hostrecord Add a name to the DNS associated to an IPv4/IPv6 address
-h, --help Show this help dialog
-i, interface Specify dnsmasq's interface listening behavior
Add '-h' for more info on interface usage"
@@ -392,12 +393,23 @@ RemoveDHCPStaticAddress() {
}
SetHostRecord() {
- if [ -n "${args[3]}" ]; then
+ if [[ "${1}" == "-h" ]] || [[ "${1}" == "--help" ]]; then
+ echo "Usage: pihole -a hostrecord [IPv4-address],[IPv6-address]
+Example: 'pihole -a hostrecord home.domain.com 192.168.1.1,2001:db8:a0b:12f0::1'
+Add a name to the DNS associated to an IPv4/IPv6 address
+
+Options:
+ \"\" Empty: Remove host record
+ -h, --help Show this help dialog"
+ exit 0
+ fi
+
+ if [[ -n "${args[3]}" ]]; then
change_setting "HOSTRECORD" "${args[2]},${args[3]}"
- echo "Setting host record for ${args[2]} -> ${args[3]}"
+ echo -e " ${TICK} Setting host record for ${args[2]} to ${args[3]}"
else
change_setting "HOSTRECORD" ""
- echo "Removing host record"
+ echo -e " ${TICK} Removing host record"
fi
ProcessDNSSettings
@@ -474,7 +486,7 @@ main() {
"resolve" ) ResolutionSettings;;
"addstaticdhcp" ) AddDHCPStaticAddress;;
"removestaticdhcp" ) RemoveDHCPStaticAddress;;
- "hostrecord" ) SetHostRecord;;
+ "-r" | "hostrecord" ) SetHostRecord "$3";;
"-i" | "interface" ) SetListeningMode "$@";;
"-t" | "teleporter" ) Teleporter;;
"adlist" ) CustomizeAdLists;;
diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index 9d264846..4047502b 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1,22 +1,21 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1090
+
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
-# Installs Pi-hole
+# Installs and Updates Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
-
-
# pi-hole.net/donate
#
# Install with this command (from your Linux machine):
#
# curl -L install.pi-hole.net | bash
-
# -e option instructs bash to immediately exit if any command [1] has a non-zero exit status
# We do not want users to end up with a partially working install, so we exit the script
# instead of continuing the installation with something broken
@@ -35,6 +34,7 @@ instalLogLoc=/etc/pihole/install.log
# This is an important file as it contains information specific to the machine it's being installed on
setupVars=/etc/pihole/setupVars.conf
# Pi-hole uses lighttpd as a Web server, and this is the config file for it
+# shellcheck disable=SC2034
lighttpdConfig=/etc/lighttpd/lighttpd.conf
# This is a file used for the colorized output
coltable=/opt/pihole/COL_TABLE
@@ -79,7 +79,7 @@ reconfigure=false
runUnattended=false
# If the color table file exists,
-if [[ -f ${coltable} ]]; then
+if [[ -f "${coltable}" ]]; then
# source it
source ${coltable}
# Othwerise,
@@ -91,8 +91,9 @@ else
TICK="[${COL_LIGHT_GREEN}✓${COL_NC}]"
CROSS="[${COL_LIGHT_RED}✗${COL_NC}]"
INFO="[i]"
+ # shellcheck disable=SC2034
DONE="${COL_LIGHT_GREEN} done!${COL_NC}"
- OVER="\r\033[K"
+ OVER="\\r\\033[K"
fi
# A simple function that just echoes out our logo in ASCII format
@@ -122,7 +123,6 @@ show_ascii_berry() {
"
}
-
# Compatibility
distro_check() {
# If apt-get is installed, then we know it's part of the Debian family
@@ -321,13 +321,13 @@ getGitFiles() {
# Show that we're checking it
echo -e "${OVER} ${TICK} ${str}"
# Update the repo, returning an error message on failure
- update_repo "${directory}" || { echo -e "\n ${COL_LIGHT_RED}Error: Could not update local repository. Contact support.${COL_NC}"; exit 1; }
+ update_repo "${directory}" || { echo -e "\\n ${COL_LIGHT_RED}Error: Could not update local repository. Contact support.${COL_NC}"; exit 1; }
# If it's not a .git repo,
else
# Show an error
echo -e "${OVER} ${CROSS} ${str}"
# Attempt to make the repository, showing an error on falure
- make_repo "${directory}" "${remoteRepo}" || { echo -e "\n ${COL_LIGHT_RED}Error: Could not update local repository. Contact support.${COL_NC}"; exit 1; }
+ 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
echo ""
@@ -380,13 +380,13 @@ 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
- whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer" "\n\nThis installer will transform your device into a network-wide ad blocker!" ${r} ${c}
+ 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
- whiptail --msgbox --backtitle "Plea" --title "Free and open source" "\n\nThe Pi-hole is free, but powered by your donations: http://pi-hole.net/donate" ${r} ${c}
+ whiptail --msgbox --backtitle "Plea" --title "Free and open source" "\\n\\nThe Pi-hole is free, but powered by your donations: http://pi-hole.net/donate" ${r} ${c}
# Explain the need for a static address
- whiptail --msgbox --backtitle "Initiating network interface" --title "Static IP Needed" "\n\nThe Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
+ whiptail --msgbox --backtitle "Initiating network interface" --title "Static IP Needed" "\\n\\nThe Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." ${r} ${c}
}
@@ -400,7 +400,8 @@ verifyFreeDiskSpace() {
# Reqired space in KB
local required_free_kilobytes=51200
# Calculate existing free space on this machine
- local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}')
+ local existing_free_kilobytes
+ existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}')
# If the existing space is not an integer,
if ! [[ "${existing_free_kilobytes}" =~ ^([0-9])+$ ]]; then
@@ -414,7 +415,7 @@ verifyFreeDiskSpace() {
# exit with an error code
exit 1
# If there is insufficient free disk space,
- elif [[ ${existing_free_kilobytes} -lt ${required_free_kilobytes} ]]; then
+ elif [[ "${existing_free_kilobytes}" -lt "${required_free_kilobytes}" ]]; then
# show an error message
echo -e " ${CROSS} ${str}
Your system disk appears to only have ${existing_free_kilobytes} KB free
@@ -428,7 +429,7 @@ verifyFreeDiskSpace() {
e.g: curl -L https://install.pi-hole.net | bash"
fi
# Show there is not enough free space
- echo -e "\n ${COL_LIGHT_RED}Insufficient free space, exiting...${COL_NC}"
+ echo -e "\\n ${COL_LIGHT_RED}Insufficient free space, exiting...${COL_NC}"
# and exit with an error
exit 1
# Otherwise,
@@ -455,7 +456,7 @@ chooseInterface() {
interfaceCount=$(echo "${availableInterfaces}" | wc -l)
# If there is one interface,
- if [[ ${interfaceCount} -eq 1 ]]; then
+ if [[ "${interfaceCount}" -eq 1 ]]; then
# Set it as the interface to use since there is no other option
PIHOLE_INTERFACE="${availableInterfaces}"
# Otherwise,
@@ -465,7 +466,7 @@ chooseInterface() {
# use a variable to set the option as OFF to begin with
mode="OFF"
# If it's the first loop,
- if [[ ${firstLoop} -eq 1 ]]; then
+ if [[ "${firstLoop}" -eq 1 ]]; then
# set this as the interface to use (ON)
firstLoop=0
mode="ON"
@@ -501,11 +502,11 @@ testIPv6() {
# will contain 162 which is the decimal value corresponding to 0xa2
value2=$(((0x$first)%256))
# the ULA test is testing for fc00::/7 according to RFC 4193
- ((($value1&254)==252)) && echo "ULA" || true
+ (((value1&254)==252)) && echo "ULA" || true
# the GUA test is testing for 2000::/3 according to RFC 4291
- ((($value1&112)==32)) && echo "GUA" || true
+ (((value1&112)==32)) && echo "GUA" || true
# the LL test is testing for fe80::/10 according to RFC 4193
- ((($value1==254) && (($value2&192)==128))) && echo "Link-local" || true
+ (((value1==254) && ((value2&192)==128))) && echo "Link-local" || true
}
# A dialog for showing the user about IPv6 blocking
@@ -529,17 +530,17 @@ useIPv6dialog() {
# set the IPv6 address to the ULA address
IPV6_ADDRESS="${ULA_ADDRESS}"
# Show this info to the user
- echo "::: Found IPv6 ULA address, using it for blocking IPv6 ads"
+ echo -e " ${INFO} Found IPv6 ULA address, using it for blocking IPv6 ads"
# Otherwise, if the GUA_ADDRESS has a value,
elif [[ ! -z "${GUA_ADDRESS}" ]]; then
# Let the user know
- echo "::: Found IPv6 GUA address, using it for blocking IPv6 ads"
+ echo -e " ${INFO} Found IPv6 GUA address, using it for blocking IPv6 ads"
# And assign it to the global variable
IPV6_ADDRESS="${GUA_ADDRESS}"
# If none of those work,
else
# explain that IPv6 blocking will not be used
- echo "::: Found neither IPv6 ULA nor GUA address, blocking IPv6 ads will not be enabled"
+ echo -e " ${INFO} Unable to find IPv6 ULA/GUA address, IPv6 adblocking will not be enabled"
# So set the variable to be empty
IPV6_ADDRESS=""
fi
@@ -575,14 +576,14 @@ use4andor6() {
esac
done
# If IPv4 is to be used,
- if [[ ${useIPv4} ]]; then
+ if [[ "${useIPv4}" ]]; then
# Run our function to get the information we need
find_IPv4_information
getStaticIPv4Settings
setStaticIPv4
fi
# If IPv6 is to be used,
- if [[ ${useIPv6} ]]; then
+ if [[ "${useIPv6}" ]]; then
# Run our function to get this information
useIPv6dialog
fi
@@ -590,7 +591,7 @@ use4andor6() {
echo -e " ${INFO} IPv4 address: ${IPV4_ADDRESS}"
echo -e " ${INFO} IPv6 address: ${IPV6_ADDRESS}"
# If neither protocol is selected,
- if [ ! ${useIPv4} ] && [ ! ${useIPv6} ]; then
+ if [[ ! "${useIPv4}" ]] && [[ ! "${useIPv6}" ]]; then
# Show an error in red
echo -e " ${COL_LIGHT_RED}Error: Neither IPv4 or IPv6 selected${COL_NC}"
# and exit with an error
@@ -616,7 +617,7 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
# Otherwise, we need to ask the user to input their desired settings.
# Start by getting the IPv4 address (pre-filling it with info gathered from DHCP)
# Start a loop to let the user enter their information with the chance to go back and edit it if necessary
- until [[ ${ipSettingsCorrect} = True ]]; do
+ until [[ "${ipSettingsCorrect}" = True ]]; do
# Ask for the IPv4 address
IPV4_ADDRESS=$(whiptail --backtitle "Calibrating network interface" --title "IPv4 address" --inputbox "Enter your desired IPv4 address" ${r} ${c} "${IPV4_ADDRESS}" 3>&1 1>&2 2>&3) || \
@@ -660,7 +661,7 @@ setStaticIPv4() {
local IPADDR
local CIDR
# For the Debian family, if dhcpcd.conf exists,
- if [[ -f /etc/dhcpcd.conf ]]; then
+ if [[ -f "/etc/dhcpcd.conf" ]]; then
# check if the IP is already in the file
if grep -q "${IPV4_ADDRESS}" /etc/dhcpcd.conf; then
echo -e " ${INFO} Static IP already configured"
@@ -672,10 +673,10 @@ setStaticIPv4() {
ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}"
# Also give a warning that the user may need to reboot their system
echo -e " ${TICK} Set IP address to ${IPV4_ADDRESS%/*}
- You may need to restart after the install is complete"
+ You may need to restart after the install is complete"
fi
# If it's not Debian, check if it's the Fedora family by checking for the file below
- elif [[ -f /etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE} ]];then
+ elif [[ -f "/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}" ]];then
# If it exists,
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${PIHOLE_INTERFACE}
# check if the desired IP is already set
@@ -710,7 +711,7 @@ setStaticIPv4() {
fi
# Show a warning that the user may need to restart
echo -e " ${TICK} Set IP address to ${IPV4_ADDRESS%/*}
- You may need to restart after the install is complete"
+ You may need to restart after the install is complete"
fi
# If all that fails,
else
@@ -727,7 +728,7 @@ valid_ip() {
local stat=1
# 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
+ 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
OIFS=$IFS
# and set the new one to a dot (period)
@@ -737,8 +738,8 @@ valid_ip() {
# Restore the IFS to what it was
IFS=${OIFS}
## Evaluate each octet by checking if it's less than or equal to 255 (the max for each octet)
- [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
- && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
+ [[ "${ip[0]}" -le 255 && "${ip[1]}" -le 255 \
+ && "${ip[2]}" -le 255 && "${ip[3]}" -le 255 ]]
# Save the exit code
stat=$?
fi
@@ -801,13 +802,13 @@ setDNS() {
;;
Custom)
# Until the DNS settings are selected,
- until [[ ${DNSSettingsCorrect} = True ]]; do
+ until [[ "${DNSSettingsCorrect}" = True ]]; do
#
strInvalid="Invalid"
# If the first
- if [ ! ${PIHOLE_DNS_1} ]; then
+ if [[ ! "${PIHOLE_DNS_1}" ]]; then
# and second upstream servers do not exist
- if [ ! ${PIHOLE_DNS_2} ]; then
+ if [[ ! "${PIHOLE_DNS_2}" ]]; then
#
prePopulate=""
# Otherwise,
@@ -816,39 +817,39 @@ setDNS() {
prePopulate=", ${PIHOLE_DNS_2}"
fi
#
- elif [ ${PIHOLE_DNS_1} ] && [ ! ${PIHOLE_DNS_2} ]; then
+ elif [[ "${PIHOLE_DNS_1}" ]] && [[ ! "${PIHOLE_DNS_2}" ]]; then
#
prePopulate="${PIHOLE_DNS_1}"
#
- elif [ ${PIHOLE_DNS_1} ] && [ ${PIHOLE_DNS_2} ]; then
+ elif [[ "${PIHOLE_DNS_1}" ]] && [[ "${PIHOLE_DNS_2}" ]]; then
#
prePopulate="${PIHOLE_DNS_1}, ${PIHOLE_DNS_2}"
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), seperated 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}')
PIHOLE_DNS_2=$(echo "${piholeDNS}" | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
# If the IP is valid,
- if ! valid_ip "${PIHOLE_DNS_1}" || [ ! "${PIHOLE_DNS_1}" ]; then
+ if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then
# store it in the variable so we can use it
PIHOLE_DNS_1=${strInvalid}
fi
# Do the same for the secondary server
- if ! valid_ip "${PIHOLE_DNS_2}" && [ "${PIHOLE_DNS_2}" ]; then
+ if ! valid_ip "${PIHOLE_DNS_2}" && [[ "${PIHOLE_DNS_2}" ]]; then
PIHOLE_DNS_2=${strInvalid}
fi
# If either of the DNS servers are invalid,
- if [[ ${PIHOLE_DNS_1} == "${strInvalid}" ]] || [[ ${PIHOLE_DNS_2} == "${strInvalid}" ]]; then
+ if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]] || [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
# explain this to the user
- whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}
+ whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\\n\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}
# and set the variables back to nothing
- if [[ ${PIHOLE_DNS_1} == "${strInvalid}" ]]; then
+ if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]]; then
PIHOLE_DNS_1=""
fi
- if [[ ${PIHOLE_DNS_2} == "${strInvalid}" ]]; then
+ if [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
PIHOLE_DNS_2=""
fi
# Since the settings will not work, stay in the loop
@@ -856,7 +857,7 @@ setDNS() {
# Othwerise,
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
+ 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
DNSSettingsCorrect=True
# Otherwise,
@@ -878,7 +879,7 @@ setLogging() {
local LogChoices
# Ask if the user wants to log queries
- LogToggleCommand=(whiptail --separate-output --radiolist "Do you want to log queries?\n (Disabling will render graphs on the Admin page useless):" ${r} ${c} 6)
+ LogToggleCommand=(whiptail --separate-output --radiolist "Do you want to log queries?\\n (Disabling will render graphs on the Admin page useless):" ${r} ${c} 6)
# The default selection is on
LogChooseOptions=("On (Recommended)" "" on
Off "" off)
@@ -916,12 +917,12 @@ setAdminFlag() {
# Depending on their choice
case ${WebChoices} in
"On (Recommended)")
- echo -e " ${INFO} Web Interface On."
+ echo -e " ${INFO} Web Interface On"
# Set it to true
INSTALL_WEB=true
;;
Off)
- echo -e " ${INFO} Web Interface off."
+ echo -e " ${INFO} Web Interface Off"
# or false
INSTALL_WEB=false
;;
@@ -939,7 +940,7 @@ version_check_dnsmasq() {
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
# If the dnsmasq config file exists
- if [ -f ${dnsmasq_conf} ]; then
+ if [[ -f "${dnsmasq_conf}" ]]; then
echo -ne " ${INFO} Existing dnsmasq.conf found..."
# If gravity.list is found within this file, we presume it's from older versions on Pi-hole,
if grep -q ${dnsmasq_pihole_id_string} ${dnsmasq_conf}; then
@@ -1048,8 +1049,8 @@ installScripts() {
# Otherwise,
else
# Show an error and exit
- echo -e "${OVER} ${CROSS} ${str}"
- echo -e " ${COL_LIGHT_RED}Error: Local repo ${PI_HOLE_LOCAL_REPO} not found, exiting installer${COL_NC}"
+ echo -e "${OVER} ${CROSS} ${str}
+ ${COL_LIGHT_RED}Error: Local repo ${PI_HOLE_LOCAL_REPO} not found, exiting installer${COL_NC}"
exit 1
fi
}
@@ -1062,15 +1063,15 @@ installConfigs() {
version_check_dnsmasq
# If the user chose to install the dashboard,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# and if the Web server conf directory does not exist,
- if [ ! -d "/etc/lighttpd" ]; then
+ if [[ ! -d "/etc/lighttpd" ]]; then
# make it
mkdir /etc/lighttpd
# and set the owners
chown "${USER}":root /etc/lighttpd
# Otherwise, if the config file already exists
- elif [ -f "/etc/lighttpd/lighttpd.conf" ]; then
+ elif [[ -f "/etc/lighttpd/lighttpd.conf" ]]; then
# back up the original
mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
fi
@@ -1164,16 +1165,13 @@ update_package_cache() {
notify_package_updates_available() {
# Local, named variables
local str="Checking ${PKG_MANAGER} for upgraded packages"
- echo ""
- echo -ne " ${INFO} ${str}..."
+ echo -ne "\\n ${INFO} ${str}..."
# Store the list of packages in a variable
updatesToInstall=$(eval "${PKG_COUNT}")
- #echo -e "\r\033[K ${TICK} ${str}"
- #echo ""
- #
+
if [[ -d "/lib/modules/$(uname -r)" ]]; then
#
- if [[ ${updatesToInstall} -eq "0" ]]; then
+ if [[ "${updatesToInstall}" -eq 0 ]]; then
#
echo -e "${OVER} ${TICK} ${str}... up to date!"
echo ""
@@ -1184,10 +1182,8 @@ notify_package_updates_available() {
echo ""
fi
else
- #
echo -e "${OVER} ${CROSS} ${str}
- Kernel update detected. If the install fails, please reboot and try again"
- echo ""
+ Kernel update detected. If the install fails, please reboot and try again\\n"
fi
}
@@ -1199,7 +1195,7 @@ install_dependent_packages() {
# Add one to the counter
counter=$((counter+1))
# If it equals 1,
- if [ ${counter} == 1 ]; then
+ if [[ "${counter}" == 1 ]]; then
#
echo -e " ${INFO} Installer Dependency checks..."
else
@@ -1233,7 +1229,7 @@ install_dependent_packages() {
fi
done
#
- if [[ ${#installArray[@]} -gt 0 ]]; then
+ if [[ "${#installArray[@]}" -gt 0 ]]; then
#
test_dpkg_lock
#
@@ -1258,7 +1254,7 @@ install_dependent_packages() {
fi
done
#
- if [[ ${#installArray[@]} -gt 0 ]]; then
+ if [[ "${#installArray[@]}" -gt 0 ]]; then
#
"${PKG_INSTALL[@]}" "${installArray[@]}" &> /dev/null
return
@@ -1273,7 +1269,7 @@ CreateLogFile() {
echo ""
echo -ne " ${INFO} ${str}..."
# If the pihole log does not exist,
- if [ ! -f /var/log/pihole.log ]; then
+ if [[ ! -f "/var/log/pihole.log" ]]; then
# Make it,
touch /var/log/pihole.log
# set the permissions,
@@ -1293,11 +1289,11 @@ installPiholeWeb() {
echo ""
echo " ${INFO} Installing blocking page..."
# If the pihole Web directory exists,
- if [ -d "/var/www/html/pihole" ]; then
+ if [[ -d "/var/www/html/pihole" ]]; then
local str="Installing index.php"
echo -ne " ${INFO} ${str}..."
# and if the index file exists,
- if [ -f "/var/www/html/pihole/index.php" ]; then
+ if [[ -f "/var/www/html/pihole/index.php" ]]; then
# do not overwrite it,
echo -e " ${COL_LIGHT_GREEN}detected index.php, not overwriting${COL_NC}"
# if it doesn't exist
@@ -1310,7 +1306,7 @@ installPiholeWeb() {
local str="Installing index.js"
echo -ne " ${INFO} ${str}..."
# and if the index file exists,
- if [ -f "/var/www/html/pihole/index.js" ]; then
+ if [[ -f "/var/www/html/pihole/index.js" ]]; then
# do not overwrite it,
echo -e " ${COL_LIGHT_GREEN}detected index.js, not overwriting${COL_NC}"
else
@@ -1322,7 +1318,7 @@ installPiholeWeb() {
local str="Installing blockingpage.css"
echo -ne " ${INFO} ${str}..."
# and if the index file exists,
- if [ -f "/var/www/html/pihole/blockingpage.css" ]; then
+ if [[ -f "/var/www/html/pihole/blockingpage.css" ]]; then
# do not overwrite it,
echo -e " ${COL_LIGHT_GREEN}detected blockingpage.css, not overwriting${COL_NC}"
else
@@ -1343,15 +1339,15 @@ installPiholeWeb() {
local str="Backing up index.lighttpd.html"
echo -ne " ${INFO} ${str}..."
# If the default index file exists,
- if [ -f /var/www/html/index.lighttpd.html ]; then
+ if [[ -f "/var/www/html/index.lighttpd.html" ]]; then
# back it up
mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
echo -e "${OVER} ${TICK} ${str}"
# Othwerwise,
else
# don't do anything
- echo -e "${OVER} ${CROSS} ${str}"
- echo -e " No default index.lighttpd.html file found... not backing up"
+ echo -e "${OVER} ${CROSS} ${str}
+ No default index.lighttpd.html file found... not backing up"
fi
fi
@@ -1435,9 +1431,9 @@ configureFirewall() {
# 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
- 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} || \
+ 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 dnsmasq."
+ echo -e " ${TICK} Configuring FirewallD for httpd and dnsmasq"
# Allow HTTP and DNS traffice
firewall-cmd --permanent --add-service=http --add-service=dns
# Reload the firewall to apply these changes
@@ -1448,9 +1444,9 @@ configureFirewall() {
# If chain Policy is not ACCEPT or last Rule is not ACCEPT
# then check and insert our Rules above the DROP/REJECT Rule.
if iptables -S INPUT | head -n1 | grep -qv '^-P.*ACCEPT$' || iptables -S INPUT | tail -n1 | grep -qv '^-\(A\|P\).*ACCEPT$'; then
- 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} || \
+ 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} Installing new IPTables firewall rulesets."
+ echo -e " ${TICK} Installing new IPTables firewall rulesets"
# Check chain first, otherwise a new rule will duplicate old ones
iptables -C INPUT -p tcp -m tcp --dport 80 -j ACCEPT &> /dev/null || iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT
iptables -C INPUT -p tcp -m tcp --dport 53 -j ACCEPT &> /dev/null || iptables -I INPUT 1 -p tcp -m tcp --dport 53 -j ACCEPT
@@ -1461,31 +1457,32 @@ configureFirewall() {
# Othwerwise,
else
# no firewall is running
- echo -e " ${INFO} No active firewall detected.. skipping firewall configuration."
+ echo -e " ${INFO} No active firewall detected.. skipping firewall configuration"
# so just exit
return 0
fi
- echo -e " ${INFO} Skipping firewall configuration."
+ echo -e " ${INFO} Skipping firewall configuration"
}
#
finalExports() {
# If the Web interface is not set to be installed,
- if [[ ${INSTALL_WEB} == false ]]; then
+ if [[ "${INSTALL_WEB}" == false ]]; then
# and if there is not an IPv4 address,
- if [ ${IPV4_ADDRESS} ]; then
+ if [[ "${IPV4_ADDRESS}" ]]; then
# there is no block page, so set IPv4 to 0.0.0.0 (all IP addresses)
IPV4_ADDRESS="0.0.0.0"
fi
- if [ ${IPV6_ADDRESS} ]; then
+ if [[ "${IPV6_ADDRESS}" ]]; then
# and IPv6 to ::/0
IPV6_ADDRESS="::/0"
fi
fi
# If the setup variable file exists,
- if [ -e "${setupVars}" ]; then
- 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}"
+ 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;' "${setupVars}"
fi
# echo the information to the user
{
@@ -1526,7 +1523,7 @@ installLogrotate() {
# the local properties of the /var/log directory
logusergroup="$(stat -c '%U %G' /var/log)"
# If the variable has a value,
- if [[ ! -z $logusergroup ]]; then
+ if [[ ! -z "${logusergroup}" ]]; then
#
sed -i "s/# su #/su ${logusergroup}/g;" /etc/pihole/logrotate
fi
@@ -1539,8 +1536,8 @@ installPihole() {
create_pihole_user
# If the user wants to install the Web interface,
- if [[ ${INSTALL_WEB} == true ]]; then
- if [ ! -d "/var/www/html" ]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
+ if [[ ! -d "/var/www/html" ]]; then
# make the Web directory if necessary
mkdir -p /var/www/html
fi
@@ -1550,13 +1547,13 @@ installPihole() {
# 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
+ 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"
+ Please ensure fastcgi is enabled if you experience issues\\n"
fi
fi
# Install scripts,
@@ -1566,7 +1563,7 @@ installPihole() {
# and create the log file
CreateLogFile
# If the user wants to install the dashboard,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# do so
installPiholeWeb
fi
@@ -1575,7 +1572,7 @@ installPihole() {
# Install the logrotate file
installLogrotate
# Check if FTL is installed
- FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
+ FTLdetect || echo -e " ${CROSS} FTL Engine not installed"
# Configure the firewall
configureFirewall
@@ -1604,7 +1601,7 @@ updatePihole() {
# Create the log file
CreateLogFile
# If the user wants to install the dasboard,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# do so
installPiholeWeb
fi
@@ -1625,19 +1622,17 @@ updatePihole() {
checkSelinux() {
# If the getenforce command exists,
if command -v getenforce &> /dev/null; then
- echo ""
- echo -ne " ${INFO} SELinux Support Detected... Mode: "
# Store the current mode in a variable
enforceMode=$(getenforce)
- echo "${enforceMode}"
+ echo -e "\\n ${INFO} SELinux mode detected: ${enforceMode}"
+
# If it's enforcing,
if [[ "${enforceMode}" == "Enforcing" ]]; then
# Explain Pi-hole does not support it yet
- whiptail --title "SELinux Enforcing Detected" --yesno "SELinux is being Enforced on your system!\n\nPi-hole currently does not support SELinux, but you may still continue with the installation.\n\nNote: Admin UI Will not function fully without setting your policies correctly\n\nContinue installing Pi-hole?" ${r} ${c} || \
- { echo ""; echo -e " ${COL_LIGHT_RED}SELinux Enforcing detected, exiting installer${COL_NC}"; exit 1; }
- echo ""
- echo -e " ${INFO} Continuing installation with SELinux Enforcing"
- echo -e " ${INFO} Please refer to official SELinux documentation to create a custom policy"
+ whiptail --defaultno --title "SELinux Enforcing Detected" --yesno "SELinux is being ENFORCED on your system! \\n\\nPi-hole currently does not support SELinux, but you may still continue with the installation.\\n\\nNote: Web Admin will not be fully functional unless you set your policies correctly\\n\\nContinue installing Pi-hole?" ${r} ${c} || \
+ { echo -e "\\n ${COL_LIGHT_RED}SELinux Enforcing detected, exiting installer${COL_NC}"; exit 1; }
+ echo -e " ${INFO} Continuing installation with SELinux Enforcing
+ ${INFO} Please refer to official SELinux documentation to create a custom policy"
fi
fi
}
@@ -1645,7 +1640,7 @@ checkSelinux() {
# Installation complete message with instructions for the user
displayFinalMessage() {
# If
- if [[ ${#1} -gt 0 ]] ; then
+ if [[ "${#1}" -gt 0 ]] ; then
pwstring="$1"
# else, if the dashboard password in the setup variables exists,
elif [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) -gt 0 ]]; then
@@ -1656,7 +1651,7 @@ displayFinalMessage() {
pwstring="NOT SET"
fi
# If the user wants to install the dashboard,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == 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
@@ -1678,7 +1673,7 @@ ${additional}" ${r} ${c}
update_dialogs() {
# If pihole -r "reconfigure" option was selected,
- if [ "${reconfigure}" = true ]; then
+ if [[ "${reconfigure}" = true ]]; then
# set some variables that will be used
opt1a="Repair"
opt1b="This will retain existing settings"
@@ -1694,7 +1689,7 @@ update_dialogs() {
opt2b="This will 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 \
+ 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 \
"${opt1a}" "${opt1b}" \
"${opt2a}" "${opt2b}" 3>&2 2>&1 1>&3) || \
{ echo -e " ${COL_LIGHT_RED}Cancel was selected, exiting installer${COL_NC}"; exit 1; }
@@ -1703,7 +1698,7 @@ update_dialogs() {
case ${UpdateCmd} in
# repair, or
${opt1a})
- echo -e " ${INFO} ${opt1a} option selected."
+ echo -e " ${INFO} ${opt1a} option selected"
useUpdateVars=true
;;
# recongigure,
@@ -1714,7 +1709,6 @@ update_dialogs() {
esac
}
-
clone_or_update_repos() {
# If the user wants to reconfigure,
if [[ "${reconfigure}" == true ]]; then
@@ -1725,7 +1719,7 @@ clone_or_update_repos() {
exit 1; \
}
# If the Web interface was installed,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# reset it's repo
resetRepo ${webInterfaceDir} || \
{ echo -e " ${COL_LIGHT_RED}Unable to reset ${webInterfaceDir}, exiting installer${COL_NC}"; \
@@ -1736,11 +1730,11 @@ clone_or_update_repos() {
else
# so get git files for Core
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} || \
- { echo "!!! Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue."; \
+ { echo -e " ${COL_LIGHT_RED}Unable to clone ${piholeGitUrl} into ${PI_HOLE_LOCAL_REPO}, unable to continue${COL_NC}"; \
exit 1; \
}
# If the Web interface was installed,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == 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}"; \
@@ -1824,21 +1818,23 @@ FTLdetect() {
local str="Detecting architecture"
echo -ne " ${INFO} ${str}..."
# If the machine is arm or aarch
- if [[ ${machine} == arm* || ${machine} == *aarch* ]]; then
+ if [[ "${machine}" == "arm"* || "${machine}" == *"aarch"* ]]; then
# ARM
#
- local rev=$(uname -m | sed "s/[^0-9]//g;")
+ local rev
+ rev=$(uname -m | sed "s/[^0-9]//g;")
#
- local lib=$(ldd /bin/ls | grep -E '^\s*/lib' | awk '{ print $1 }')
+ local lib
+ lib=$(ldd /bin/ls | grep -E '^\s*/lib' | awk '{ print $1 }')
#
- if [[ "$lib" == "/lib/ld-linux-aarch64.so.1" ]]; then
+ if [[ "${lib}" == "/lib/ld-linux-aarch64.so.1" ]]; then
echo -e "${OVER} ${TICK} Detected ARM-aarch64 architecture"
# set the binary to be used
binary="pihole-FTL-aarch64-linux-gnu"
#
- elif [[ "$lib" == "/lib/ld-linux-armhf.so.3" ]]; then
+ elif [[ "${lib}" == "/lib/ld-linux-armhf.so.3" ]]; then
#
- if [ "$rev" -gt "6" ]; then
+ if [[ "${rev}" -gt 6 ]]; then
echo -e "${OVER} ${TICK} Detected ARM-hf architecture (armv7+)"
# set the binary to be used
binary="pihole-FTL-arm-linux-gnueabihf"
@@ -1853,22 +1849,22 @@ FTLdetect() {
# set the binary to be used
binary="pihole-FTL-arm-linux-gnueabi"
fi
- elif [[ $machine == ppc ]]; then
+ elif [[ "${machine}" == "ppc" ]]; then
# PowerPC
- echo "::: Detected PowerPC architecture"
+ echo -e "${OVER} ${TICK} Detected PowerPC architecture"
# set the binary to be used
binary="pihole-FTL-powerpc-linux-gnu"
- elif [[ ${machine} == x86_64 ]]; then
+ elif [[ "${machine}" == "x86_64" ]]; then
# 64bit
echo -e "${OVER} ${TICK} Detected x86_64 architecture"
# set the binary to be used
binary="pihole-FTL-linux-x86_64"
else
# Something else - we try to use 32bit executable and warn the user
- if [[ ! ${machine} == i686 ]]; then
+ if [[ ! "${machine}" == "i686" ]]; then
echo -e "${OVER} ${CROSS} ${str}...
- ${COL_LIGHT_RED}Not able to detect architecture (unknown: ${machine}), trying 32bit executable
- Contact support if you experience issues (e.g: FTL not running)${COL_NC}"
+ ${COL_LIGHT_RED}Not able to detect architecture (unknown: ${machine}), trying 32bit executable${COL_NC}
+ Contact Pi-hole Support if you experience issues (e.g: FTL not running)"
else
echo -e "${OVER} ${TICK} Detected 32bit (i686) architecture"
fi
@@ -1910,7 +1906,6 @@ FTLdetect() {
}
main() {
-
######## FIRST CHECK ########
# Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked
show_ascii_berry
@@ -1919,18 +1914,17 @@ main() {
echo ""
# If the user's id is zero,
- if [[ ${EUID} -eq 0 ]]; then
+ if [[ "${EUID}" -eq 0 ]]; then
# they are root and all is good
echo -e " ${TICK} ${str}"
# Otherwise,
else
# They do not have enough privileges, so let the user know
echo -e " ${CROSS} ${str}
- Script called with non-root privileges
- The Pi-hole requires elevated privleges to install and run
- Please check the installer for any concerns regarding this requirement
- Make sure to download this script from a trusted source"
- echo ""
+ ${COL_LIGHT_RED}Script called with non-root privileges${COL_NC}
+ The Pi-hole requires elevated privleges to install and run
+ Please check the installer for any concerns regarding this requirement
+ Make sure to download this script from a trusted source\\n"
echo -ne " ${INFO} Sudo utility check"
# If the sudo command exists,
@@ -1943,7 +1937,7 @@ main() {
else
# Let them know they need to run it as root
echo -e "${OVER} ${CROSS} Sudo utility check
- Sudo is needed for the Web Interface to run pihole commands\n
+ Sudo is needed for the Web Interface to run pihole commands\\n
${COL_LIGHT_RED}Please re-run this installer as root${COL_NC}"
exit 1
fi
@@ -1962,7 +1956,7 @@ main() {
done
# If the setup variable file exists,
- if [[ -f ${setupVars} ]]; then
+ if [[ -f "${setupVars}" ]]; then
# if it's running unattended,
if [[ "${runUnattended}" == true ]]; then
echo -e " ${INFO} Performing unattended setup, no whiptail dialogs will be displayed"
@@ -1995,15 +1989,14 @@ main() {
# Check if SELinux is Enforcing
checkSelinux
-
- if [[ ${useUpdateVars} == false ]]; then
+ if [[ "${useUpdateVars}" == false ]]; then
# Display welcome dialogs
welcomeDialogs
# Create directory for Pi-hole storage
mkdir -p /etc/pihole/
stop_service dnsmasq
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
stop_service lighttpd
fi
# Determine available interfaces
@@ -2022,7 +2015,7 @@ main() {
clone_or_update_repos
# Install packages used by the Pi-hole
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# Install the Web dependencies
DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
# Otherwise,
@@ -2046,11 +2039,11 @@ main() {
# Clone/Update the repos
clone_or_update_repos
- # Source ${setupVars} for use in the rest of the functions.
+ # Source ${setupVars} for use in the rest of the functions
source ${setupVars}
# Install packages used by the Pi-hole
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# Install the Web dependencies
DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
# Otherwise,
@@ -2074,13 +2067,14 @@ main() {
# Move the log file into /etc/pihole for storage
mv ${tmpLog} ${instalLogLoc}
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# Add password to web UI if there is none
pw=""
# If no password is set,
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
# generate a random password
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
+ # shellcheck disable=SC1091
. /opt/pihole/webpage.sh
echo "WEBPASSWORD=$(HashPassword ${pw})" >> ${setupVars}
fi
@@ -2115,20 +2109,19 @@ main() {
fi
# If the Web interface was installed,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
# If there is a password,
if (( ${#pw} > 0 )) ; then
# display the password
echo -e " ${INFO} Web Interface password: ${COL_LIGHT_GREEN}${pw}${COL_NC}
- This can be changed using 'pihole -a -p'"
- echo ""
+ This can be changed using 'pihole -a -p'\\n"
fi
fi
#
if [[ "${useUpdateVars}" == false ]]; then
# If the Web interface was installed,
- if [[ ${INSTALL_WEB} == true ]]; then
+ if [[ "${INSTALL_WEB}" == true ]]; then
echo -e " View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin"
echo ""
fi
@@ -2145,7 +2138,7 @@ main() {
fi
# Display where the log file is
- echo -e "\n ${INFO} The install log is located at: /etc/pihole/install.log
+ echo -e "\\n ${INFO} The install log is located at: /etc/pihole/install.log
${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}"
}
diff --git a/test/test_automated_install.py b/test/test_automated_install.py
index 9129c314..7f1a86a1 100644
--- a/test/test_automated_install.py
+++ b/test/test_automated_install.py
@@ -80,7 +80,7 @@ def test_configureFirewall_firewalld_running_no_errors(Pihole):
source /opt/pihole/basic-install.sh
configureFirewall
''')
- expected_stdout = 'Configuring FirewallD for httpd and dnsmasq.'
+ expected_stdout = 'Configuring FirewallD for httpd and dnsmasq'
assert expected_stdout in configureFirewall.stdout
firewall_calls = Pihole.run('cat /var/log/firewall-cmd').stdout
assert 'firewall-cmd --state' in firewall_calls
@@ -95,7 +95,7 @@ def test_configureFirewall_firewalld_disabled_no_errors(Pihole):
source /opt/pihole/basic-install.sh
configureFirewall
''')
- expected_stdout = 'No active firewall detected.. skipping firewall configuration.'
+ expected_stdout = 'No active firewall detected.. skipping firewall configuration'
assert expected_stdout in configureFirewall.stdout
def test_configureFirewall_firewalld_enabled_declined_no_errors(Pihole):
@@ -444,7 +444,7 @@ def test_IPv6_only_link_local(Pihole):
source /opt/pihole/basic-install.sh
useIPv6dialog
''')
- expected_stdout = 'Found neither IPv6 ULA nor GUA address, blocking IPv6 ads will not be enabled'
+ expected_stdout = 'Unable to find IPv6 ULA/GUA address, IPv6 adblocking will not be enabled'
assert expected_stdout in detectPlatform.stdout
def test_IPv6_only_ULA(Pihole):
From f38912a0c922709a3cb5f7e256fd466dc8abaade Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Thu, 27 Jul 2017 21:33:41 +0100
Subject: [PATCH 105/116] - Correctly overwrite ${INFO} boxes with ${CROSS} etc
- Notify user that branch has been changed
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeCheckout.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index f214d2ce..1f784cbe 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -171,7 +171,11 @@ checkout_pull_branch() {
oldbranch="$(git symbolic-ref HEAD)"
+ str="Switching to branch: ${branch}"
+ echo -ne " ${INFO} $str"
git checkout "${branch}" --quiet || return 1
+ echo -e "${OVER} ${TICK} $str"
+
if [[ "$(git diff "${oldbranch}" | grep -c "^")" -gt "0" ]]; then
update="true"
@@ -180,7 +184,7 @@ checkout_pull_branch() {
git_pull=$(git pull || return 1)
if [[ "$git_pull" == *"up-to-date"* ]]; then
- echo -e " ${INFO} $(git pull)"
+ echo -e " ${INFO} ${git_pull}"
else
echo -e "$git_pull\\n"
fi
@@ -271,7 +275,7 @@ checkout() {
str="Fetching branches from ${piholeGitUrl}"
echo -ne " ${INFO} $str"
if ! fully_fetch_repo "${PI_HOLE_FILES_DIR}" ; then
- echo -e " ${CROSS} $str"
+ echo -e "${OVER} ${CROSS} $str"
exit 1
fi
corebranches=($(get_available_branches "${PI_HOLE_FILES_DIR}"))
@@ -298,7 +302,7 @@ checkout() {
str="Fetching branches from ${webInterfaceGitUrl}"
echo -ne " ${INFO} $str"
if ! fully_fetch_repo "${webInterfaceDir}" ; then
- echo -e " ${CROSS} $str"
+ echo -e "${OVER} ${CROSS} $str"
exit 1
fi
webbranches=($(get_available_branches "${webInterfaceDir}"))
From d90489b31d074630fb99e30d763e5a0707eb1424 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Thu, 27 Jul 2017 22:21:25 +0100
Subject: [PATCH 106/116] Include branch we're switching from
Signed-off-by: Adam Warner
---
advanced/Scripts/piholeCheckout.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh
index 1f784cbe..9e97c69c 100644
--- a/advanced/Scripts/piholeCheckout.sh
+++ b/advanced/Scripts/piholeCheckout.sh
@@ -171,7 +171,7 @@ checkout_pull_branch() {
oldbranch="$(git symbolic-ref HEAD)"
- str="Switching to branch: ${branch}"
+ str="Switching to branch: '${branch}' from '${oldbranch}'"
echo -ne " ${INFO} $str"
git checkout "${branch}" --quiet || return 1
echo -e "${OVER} ${TICK} $str"
From 57878957944999c8917be95e8845a50e94f49bec Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Fri, 28 Jul 2017 16:10:13 +0100
Subject: [PATCH 107/116] stop an extra `h` being added to leasetime of DHCP
server. We already storethe `h` in `setupVars.conf`
Signed-off-by: Adam Warner
---
advanced/Scripts/webpage.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index 9d101482..a72a0709 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -264,7 +264,7 @@ ProcessDHCPSettings() {
leasetime="24h"
change_setting "DHCP_LEASETIME" "${leasetime}"
else
- leasetime="${DHCP_LEASETIME}h"
+ leasetime="${DHCP_LEASETIME}"
fi
# Write settings to file
From 4fb66e632fbb35e72af2f08e37b3e6c6f6c5534b Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Fri, 28 Jul 2017 16:30:03 +0100
Subject: [PATCH 108/116] The other h
---
advanced/Scripts/webpage.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index a72a0709..b0d88284 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -261,10 +261,10 @@ ProcessDHCPSettings() {
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
leasetime="infinite"
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
- leasetime="24h"
+ leasetime="24"
change_setting "DHCP_LEASETIME" "${leasetime}"
else
- leasetime="${DHCP_LEASETIME}"
+ leasetime="${DHCP_LEASETIME}h"
fi
# Write settings to file
From 0a9965292cd0918477b186c1f2981979c67e1933 Mon Sep 17 00:00:00 2001
From: Adam Warner
Date: Fri, 28 Jul 2017 19:40:13 +0100
Subject: [PATCH 109/116] Additional check to fix any existing cases of "24h"
in setupVars.conf automatically.
Signed-off-by: Adam Warner
---
advanced/Scripts/webpage.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh
index b0d88284..560bebd0 100755
--- a/advanced/Scripts/webpage.sh
+++ b/advanced/Scripts/webpage.sh
@@ -263,6 +263,11 @@ ProcessDHCPSettings() {
elif [[ "${DHCP_LEASETIME}" == "" ]]; then
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}"
else
leasetime="${DHCP_LEASETIME}h"
fi
From defc17ba464829a14bb901eda10ba8abedaaec11 Mon Sep 17 00:00:00 2001
From: Dan Schaper
Date: Fri, 28 Jul 2017 20:24:27 -0700
Subject: [PATCH 110/116] Remove DO from README.md
Preparation for futher infrastructure changes. Will remove the DO slug from README and adjust some wording.
---
README.md | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 6f8813fa..832c9fcf 100644
--- a/README.md
+++ b/README.md
@@ -18,13 +18,9 @@ Block ads for **all** your devices _without_ the need to install client-side sof
- Internet-connected home automation
- Anything that communicates with the Internet
-
-
-
-
## Your Support Still Matters
-Digital Ocean helps with our infrastructure, but our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
+All our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
-  [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
-  Bitcoin Address: 1GKnevUnVaQM2pQieMyeHkpr8DXfkpfAtL
From 2f36acae4969c14a9c4f8a66e0ead3de14984d5d Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Wed, 23 Aug 2017 11:51:16 +1000
Subject: [PATCH 111/116] Remove errornous space
---
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 4047502b..4fc94837 100755
--- a/automated install/basic-install.sh
+++ b/automated install/basic-install.sh
@@ -1216,7 +1216,7 @@ install_dependent_packages() {
if command -v debconf-apt-progress &> /dev/null; then
# For each package,
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
#
@@ -1243,7 +1243,7 @@ install_dependent_packages() {
# Install Fedora/CentOS packages
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
echo -e "${OVER} ${TICK} Checking for $i"
From 7311db3a637e23a2c4fc57d5e20bdd4a1fef4103 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Mon, 28 Aug 2017 13:28:23 +1000
Subject: [PATCH 112/116] Change wording to support feature PR's
* Also clarify template suggestion text
* Remove stray '
---
.github/PULL_REQUEST_TEMPLATE.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index aefe5bea..fc719223 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-**By submitting this pull request, I confirm the following:** `{please fill the checkboxes, e.g: [X]}`
+**By submitting this pull request, I confirm the following:** `{please fill any appropriate checkboxes, e.g: [X]}`
`{Please ensure that your pull request is for the 'development' branch!}`
@@ -13,13 +13,13 @@
---
-**What does this PR aim to fix?:**
+**What does this PR aim to accomplish?:**
-`{A detailed description and/or screenshots of the issue, and links to any relevant GitHub issues}`
+`{A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues}`
-**How does this PR fix the issue?:**
+**How does this PR accomplish the above?:**
-`{A detailed description and/or screenshots of the implemented fix}`
+`{A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix}`
**What documentation changes (if any) are needed to support this PR?:**
@@ -29,4 +29,4 @@
> * You must follow the template instructions. Failure to do so will result in your issue being closed.
> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
> * Detail helps us understand an issue quicker, but please ensure it's relevant.
-> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._'
+> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
From 3125d24dedfa58143339516580e3dd8f304a691d Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Thu, 31 Aug 2017 17:39:41 +1000
Subject: [PATCH 113/116] Replace superseded netstat command
* Make colfile readonly, and use path of PI_HOLE_SCRIPT_DIR
* Rename piholeStatus function to statusFunc for function name consistency
* Replace superseded netstat command with nc
* Perform addn-hosts check using a single grep subshell
---
pihole | 71 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/pihole b/pihole
index 61ed6cd6..80d9e379 100755
--- a/pihole
+++ b/pihole
@@ -1,4 +1,5 @@
#!/bin/bash
+
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
@@ -8,11 +9,11 @@
# This file is copyright under the latest version of the EUPL.
# 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 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
if [[ ! $EUID -eq 0 ]];then
@@ -481,41 +482,41 @@ Options:
echo -e "${OVER} ${TICK} ${str}"
}
-piholeStatus() {
- if [[ "$(netstat -plnt | grep -c ':53 ')" -gt "0" ]]; then
- if [[ "${1}" != "web" ]]; then
- echo -e " ${TICK} DNS service is running"
- fi
+statusFunc() {
+ local addnConfigs
+
+ # Determine if service is running on port 53
+ if nc -z 127.0.0.1 53; then
+ [[ "${1}" != "web" ]] && echo -e " ${TICK} DNS service is running"
else
- if [[ "${1}" == "web" ]]; then
- echo "-1";
- else
- echo -e " ${CROSS} DNS service is NOT running"
- fi
- return
+ case "${1}" in
+ "web") echo "-1";;
+ *) echo -e " ${CROSS} DNS service is NOT running";;
+ esac
+ return 0
fi
- if [[ "$(grep -i "^#addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)" ]]; then
- # List is commented out
- if [[ "${1}" == "web" ]]; then
- echo 0;
- else
- echo -e " ${CROSS} Pi-hole blocking is Disabled";
- fi
- elif [[ "$(grep -i "^addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)" ]]; then
- # List set
- if [[ "${1}" == "web" ]]; then
- echo 1;
- else
- echo -e " ${TICK} Pi-hole blocking is Enabled";
- fi
+ # Determine if any of Pi-hole's addn-hosts configs are commented out
+ addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)
+
+ if [[ "${addnConfigs}" =~ "#" ]]; then
+ # A config is commented out
+ case "${1}" in
+ "web") echo 0;;
+ *) echo -e " ${CROSS} Pi-hole blocking is Disabled";;
+ esac
+ elif [[ -n "${addnConfigs}" ]]; then
+ # Configs are set
+ case "${1}" in
+ "web") echo 1;;
+ *) echo -e " ${TICK} Pi-hole blocking is Enabled";;
+ esac
else
- # Addn-host not found
- if [[ "${1}" == "web" ]]; then
- echo 99
- else
- echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state"
- fi
+ # No configs were found
+ case "${1}" in
+ "web") echo 99;;
+ *) echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state";;
+ esac
# Add addn-host= to dnsmasq
echo "addn-hosts=/etc/pihole/gravity.list" >> /etc/dnsmasq.d/01-pihole.conf
restartDNS
@@ -651,7 +652,7 @@ case "${1}" in
"uninstall" ) uninstallFunc;;
"enable" ) piholeEnable 1;;
"disable" ) piholeEnable 0 "$2";;
- "status" ) piholeStatus "$2";;
+ "status" ) statusFunc "$2";;
"restartdns" ) restartDNS;;
"-a" | "admin" ) webpageFunc "$@";;
"-t" | "tail" ) tailFunc;;
From 15a5f425bfa2991b58c3698ff44e5890125dc707 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Thu, 31 Aug 2017 20:32:02 +1000
Subject: [PATCH 114/116] Replace nc with psuedo-device
* Also fix minor conditional style issue
---
pihole | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pihole b/pihole
index 80d9e379..ded79f71 100755
--- a/pihole
+++ b/pihole
@@ -485,9 +485,11 @@ Options:
statusFunc() {
local addnConfigs
- # Determine if service is running on port 53
- if nc -z 127.0.0.1 53; then
- [[ "${1}" != "web" ]] && echo -e " ${TICK} DNS service is running"
+ # 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
+ echo -e " ${TICK} DNS service is running"
+ fi
else
case "${1}" in
"web") echo "-1";;
@@ -496,7 +498,7 @@ statusFunc() {
return 0
fi
- # Determine if any of Pi-hole's addn-hosts configs are commented out
+ # Determine if Pi-hole's addn-hosts configs are commented out
addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)
if [[ "${addnConfigs}" =~ "#" ]]; then
@@ -562,7 +564,7 @@ tricorderFunc() {
exit 1
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"
exit 1
fi
From ea1aad977472dfa4abe58d5e75e6a07199701af7 Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Fri, 1 Sep 2017 10:17:08 +1000
Subject: [PATCH 115/116] Add review suggestions to template
---
.github/PULL_REQUEST_TEMPLATE.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index fc719223..9ac82474 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -2,13 +2,14 @@
`{Please ensure that your pull request is for the 'development' branch!}`
-- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
-- [] I have performed relevant testing to verify that they work with my change.
-- [] I have squashed any insignificant commits.
-- [] This change has comments for package types, values, functions, and non-obvious lines of code.
+- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
+- [] I have made only one major change in my proposed changes.
+- [] I have commented my proposed changes within the code.
+- [] I have tested my proposed changes, and have included unit tests where possible.
- [] I am willing to help maintain this change if there are issues with it later.
- [] I give this submission freely and claim no ownership.
- [] It is compatible with the EUPL 1.2 license.
+- [] I have squashed any insignificant commits using [`git rebase`](https://git-scm.com/docs/git-rebase).
- [] I have Signed Off all commits. ([`git commit --signoff`](https://git-scm.com/docs/git-commit#git-commit---signoff))
---
@@ -29,4 +30,3 @@
> * You must follow the template instructions. Failure to do so will result in your issue being closed.
> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
> * Detail helps us understand an issue quicker, but please ensure it's relevant.
-> * _This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
From b354f722bec0402fa356163859ff2444cd9bceef Mon Sep 17 00:00:00 2001
From: WaLLy3K
Date: Sat, 2 Sep 2017 21:52:54 +1000
Subject: [PATCH 116/116] Add link for EUPL
* Also formatted `git rebase` text to be consistent with `git commit --signoff`
Signed-off-by: WaLLy3K
---
.github/PULL_REQUEST_TEMPLATE.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 9ac82474..96ce4ba5 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -8,8 +8,8 @@
- [] I have tested my proposed changes, and have included unit tests where possible.
- [] I am willing to help maintain this change if there are issues with it later.
- [] I give this submission freely and claim no ownership.
-- [] It is compatible with the EUPL 1.2 license.
-- [] I have squashed any insignificant commits using [`git rebase`](https://git-scm.com/docs/git-rebase).
+- [] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
+- [] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
- [] I have Signed Off all commits. ([`git commit --signoff`](https://git-scm.com/docs/git-commit#git-commit---signoff))
---