Compare commits
69 Commits
v6.1.1
...
95021fce58
| Author | SHA1 | Date | |
|---|---|---|---|
| 95021fce58 | |||
| ae048201a2 | |||
| dad27f8d06 | |||
| c0b512be60 | |||
| cef7fd4b02 | |||
| c09da77e2b | |||
| 18e8396a44 | |||
| 1bef0415db | |||
| d6a83baf4f | |||
| 605ff8183a | |||
| 9494dc6061 | |||
| 9605ccc178 | |||
| 86bdae0076 | |||
| 1e88ce4975 | |||
| bb60e2e346 | |||
| 3977a312f0 | |||
| b3d193b34c | |||
| 0a36e9d949 | |||
| 6db6c68a4e | |||
| 5b5e02d492 | |||
| a2dd0e2f50 | |||
| 3d75ea6df2 | |||
| 080e1ccf8a | |||
| 24f32d48af | |||
| 8486cfd95a | |||
| c81d5019a3 | |||
| c5c5116e53 | |||
| 2f9fa80d7a | |||
| f2280eb330 | |||
| f24fc9573a | |||
| 3a35e589f2 | |||
| 19d5943440 | |||
| f90677a1ff | |||
| daec6f8c02 | |||
| a48665c7bb | |||
| 8a97a1433a | |||
| f94d9f2540 | |||
| 830c4bc049 | |||
| 1dbe425146 | |||
| fc2f7795e9 | |||
| 0bc06ed204 | |||
| 700c892dff | |||
| 405053692a | |||
| 04d9d32444 | |||
| c19e907c0c | |||
| 7a16024020 | |||
| 5777497f52 | |||
| 404dc7cb88 | |||
| 2f3dfef862 | |||
| b39c9956e8 | |||
| 70bcb0bb2b | |||
| 2c1032090d | |||
| b5adc981c2 | |||
| 3933cb0575 | |||
| 6964cd124e | |||
| d16c049768 | |||
| 5ff4f000d5 | |||
| 93ecfb9504 | |||
| ea61755881 | |||
| 6130b800e3 | |||
| ec892ec096 | |||
| a590b77431 | |||
| 95d27ac985 | |||
| 7a641f4c35 | |||
| 13d76abff7 | |||
| 76e41aeefa | |||
| 774037834b | |||
| 89c4248315 | |||
| 6fc5bf83f4 |
@@ -8,6 +8,10 @@ updates:
|
|||||||
time: "10:00"
|
time: "10:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
target-branch: development
|
target-branch: development
|
||||||
|
groups:
|
||||||
|
github-actions-dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
- package-ecosystem: pip
|
- package-ecosystem: pip
|
||||||
directory: "/test"
|
directory: "/test"
|
||||||
schedule:
|
schedule:
|
||||||
@@ -16,3 +20,7 @@ updates:
|
|||||||
time: "10:00"
|
time: "10:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
target-branch: development
|
target-branch: development
|
||||||
|
groups:
|
||||||
|
python-dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ changelog:
|
|||||||
exclude:
|
exclude:
|
||||||
labels:
|
labels:
|
||||||
- internal
|
- internal
|
||||||
|
- dependencies
|
||||||
authors:
|
authors:
|
||||||
- dependabot
|
- dependabot
|
||||||
- github-actions
|
- github-actions
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
days-before-close: 5
|
days-before-close: 5
|
||||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.'
|
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.'
|
||||||
stale-issue-label: '${{ env.stale_label }}'
|
stale-issue-label: '${{ env.stale_label }}'
|
||||||
exempt-issue-labels: 'Internal, Fixed in next release, Bug: Confirmed, Documentation Needed'
|
exempt-issue-labels: 'Internal, Fixed in next release, Bug: Confirmed, Documentation Needed, never-stale'
|
||||||
exempt-all-issue-assignees: true
|
exempt-all-issue-assignees: true
|
||||||
operations-per-run: 300
|
operations-per-run: 300
|
||||||
close-issue-reason: 'not_planned'
|
close-issue-reason: 'not_planned'
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5.6.0
|
uses: actions/setup-python@v5.6.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.13"
|
||||||
|
|
||||||
- name: Install wheel
|
- name: Install wheel
|
||||||
run: pip install wheel
|
run: pip install wheel
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
# shellcheck disable=SC2034 # Disable warning about unused variables
|
||||||
|
|
||||||
# Determine if terminal is capable of showing colors
|
# Determine if terminal is capable of showing colors
|
||||||
if [ -t 1 ] && [ "$(tput colors)" -ge 8 ]; then
|
# When COL_TABLE is sourced via gravity invoked by FTL, FORCE_COLOR is set to true
|
||||||
|
if { [ -t 1 ] && [ "$(tput colors)" -ge 8 ]; } || [ "${FORCE_COLOR}" ]; then
|
||||||
# Bold and underline may not show up on all clients
|
# Bold and underline may not show up on all clients
|
||||||
# If something MUST be emphasized, use both
|
# If something MUST be emphasized, use both
|
||||||
COL_BOLD='[1m'
|
COL_BOLD='[1m'
|
||||||
COL_ULINE='[4m'
|
|
||||||
|
|
||||||
COL_NC='[0m'
|
COL_NC='[0m'
|
||||||
COL_GRAY='[90m'
|
COL_GRAY='[90m'
|
||||||
COL_RED='[91m'
|
COL_RED='[91m'
|
||||||
@@ -17,8 +18,6 @@ if [ -t 1 ] && [ "$(tput colors)" -ge 8 ]; then
|
|||||||
else
|
else
|
||||||
# Provide empty variables for `set -u`
|
# Provide empty variables for `set -u`
|
||||||
COL_BOLD=""
|
COL_BOLD=""
|
||||||
COL_ULINE=""
|
|
||||||
|
|
||||||
COL_NC=""
|
COL_NC=""
|
||||||
COL_GRAY=""
|
COL_GRAY=""
|
||||||
COL_RED=""
|
COL_RED=""
|
||||||
@@ -29,22 +28,8 @@ else
|
|||||||
COL_CYAN=""
|
COL_CYAN=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Deprecated variables
|
|
||||||
COL_WHITE="${COL_BOLD}"
|
|
||||||
COL_BLACK="${COL_NC}"
|
|
||||||
COL_LIGHT_BLUE="${COL_BLUE}"
|
|
||||||
COL_LIGHT_GREEN="${COL_GREEN}"
|
|
||||||
COL_LIGHT_CYAN="${COL_CYAN}"
|
|
||||||
COL_LIGHT_RED="${COL_RED}"
|
|
||||||
COL_URG_RED="${COL_RED}${COL_BOLD}${COL_ULINE}"
|
|
||||||
COL_LIGHT_PURPLE="${COL_PURPLE}"
|
|
||||||
COL_BROWN="${COL_YELLOW}"
|
|
||||||
COL_LIGHT_GRAY="${COL_GRAY}"
|
|
||||||
COL_DARK_GRAY="${COL_GRAY}"
|
|
||||||
|
|
||||||
TICK="[${COL_GREEN}✓${COL_NC}]"
|
TICK="[${COL_GREEN}✓${COL_NC}]"
|
||||||
CROSS="[${COL_RED}✗${COL_NC}]"
|
CROSS="[${COL_RED}✗${COL_NC}]"
|
||||||
INFO="[i]"
|
INFO="[i]"
|
||||||
QST="[?]"
|
QST="[?]"
|
||||||
DONE="${COL_GREEN} done!${COL_NC}"
|
|
||||||
OVER="\\r[K"
|
OVER="\\r[K"
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ TestAPIAvailability() {
|
|||||||
local chaos_api_list authResponse authStatus authData apiAvailable DNSport
|
local chaos_api_list authResponse authStatus authData apiAvailable DNSport
|
||||||
|
|
||||||
# as we are running locally, we can get the port value from FTL directly
|
# as we are running locally, we can get the port value from FTL directly
|
||||||
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck source=./advanced/Scripts/utils.sh
|
# shellcheck source=./advanced/Scripts/utils.sh
|
||||||
. "${utilsfile}"
|
. "${utilsfile}"
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
# This file is copyright under the latest version of the EUPL.
|
# This file is copyright under the latest version of the EUPL.
|
||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck source="./advanced/Scripts/utils.sh"
|
# shellcheck source="./advanced/Scripts/utils.sh"
|
||||||
source "${utilsfile}"
|
source "${utilsfile}"
|
||||||
|
|
||||||
readonly apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
|
apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
|
||||||
# shellcheck source="./advanced/Scripts/api.sh"
|
# shellcheck source="./advanced/Scripts/api.sh"
|
||||||
source "${apifile}"
|
source "${apifile}"
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
|||||||
warning1() {
|
warning1() {
|
||||||
echo " Please note that changing branches severely alters your Pi-hole subsystems"
|
echo " Please note that changing branches severely alters your Pi-hole subsystems"
|
||||||
echo " Features that work on the master branch, may not on a development branch"
|
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}"
|
echo -e " ${COL_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
|
read -r -p " Have you read and understood this? [y/N] " response
|
||||||
case "${response}" in
|
case "${response}" in
|
||||||
[yY][eE][sS]|[yY])
|
[yY][eE][sS]|[yY])
|
||||||
@@ -55,19 +55,19 @@ checkout() {
|
|||||||
|
|
||||||
# This is unlikely
|
# This is unlikely
|
||||||
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
|
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
|
||||||
echo -e " ${COL_LIGHT_RED}Error: Core Pi-hole repo is missing from system!"
|
echo -e " ${COL_RED}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 " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_repo "${webInterfaceDir}" ; then
|
if ! is_repo "${webInterfaceDir}" ; then
|
||||||
echo -e " ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!"
|
echo -e " ${COL_RED}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 " Please re-run install script from https://github.com/pi-hole/pi-hole${COL_NC}"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${1}" ]]; then
|
if [[ -z "${1}" ]]; then
|
||||||
echo -e " ${COL_LIGHT_RED}Invalid option${COL_NC}"
|
echo -e " ${COL_RED}Invalid option${COL_NC}"
|
||||||
echo -e " Try 'pihole checkout --help' for more information."
|
echo -e " Try 'pihole checkout --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -238,7 +238,7 @@ checkout() {
|
|||||||
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then
|
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -e " ${COL_LIGHT_RED} Error: Unable to complete update, please contact support${COL_NC}"
|
echo -e " ${COL_RED} Error: Unable to complete update, please contact support${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ check_firewalld() {
|
|||||||
# test common required service ports
|
# test common required service ports
|
||||||
local firewalld_enabled_services
|
local firewalld_enabled_services
|
||||||
firewalld_enabled_services=$(firewall-cmd --list-services)
|
firewalld_enabled_services=$(firewall-cmd --list-services)
|
||||||
local firewalld_expected_services=("http" "dns" "dhcp" "dhcpv6")
|
local firewalld_expected_services=("http" "https" "dns" "dhcp" "dhcpv6" "ntp")
|
||||||
for i in "${firewalld_expected_services[@]}"; do
|
for i in "${firewalld_expected_services[@]}"; do
|
||||||
if [[ "${firewalld_enabled_services}" =~ ${i} ]]; then
|
if [[ "${firewalld_enabled_services}" =~ ${i} ]]; then
|
||||||
log_write "${TICK} ${COL_GREEN} Allow Service: ${i}${COL_NC}";
|
log_write "${TICK} ${COL_GREEN} Allow Service: ${i}${COL_NC}";
|
||||||
@@ -388,14 +388,6 @@ check_firewalld() {
|
|||||||
else
|
else
|
||||||
log_write "${CROSS} ${COL_RED} Local Interface Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
log_write "${CROSS} ${COL_RED} Local Interface Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
||||||
fi
|
fi
|
||||||
# check FTL custom zone port: 4711
|
|
||||||
local firewalld_ftl_zone_ports
|
|
||||||
firewalld_ftl_zone_ports=$(firewall-cmd --zone=ftl --list-ports)
|
|
||||||
if [[ "${firewalld_ftl_zone_ports}" =~ "4711/tcp" ]]; then
|
|
||||||
log_write "${TICK} ${COL_GREEN} FTL Port 4711/tcp Detected${COL_NC}";
|
|
||||||
else
|
|
||||||
log_write "${CROSS} ${COL_RED} FTL Port 4711/tcp Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
log_write "${CROSS} ${COL_RED}FTL Custom Zone Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
log_write "${CROSS} ${COL_RED}FTL Custom Zone Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
|
||||||
fi
|
fi
|
||||||
@@ -497,16 +489,25 @@ ping_gateway() {
|
|||||||
ping_ipv4_or_ipv6 "${protocol}"
|
ping_ipv4_or_ipv6 "${protocol}"
|
||||||
# Check if we are using IPv4 or IPv6
|
# Check if we are using IPv4 or IPv6
|
||||||
# Find the default gateways using IPv4 or IPv6
|
# Find the default gateways using IPv4 or IPv6
|
||||||
local gateway gateway_addr gateway_iface
|
local gateway gateway_addr gateway_iface default_route
|
||||||
|
|
||||||
log_write "${INFO} Default IPv${protocol} gateway(s):"
|
log_write "${INFO} Default IPv${protocol} gateway(s):"
|
||||||
|
|
||||||
while IFS= read -r gateway; do
|
while IFS= read -r default_route; do
|
||||||
log_write " $(cut -d ' ' -f 3 <<< "${gateway}")%$(cut -d ' ' -f 5 <<< "${gateway}")"
|
gateway_addr=$(jq -r '.gateway' <<< "${default_route}")
|
||||||
done < <(ip -"${protocol}" route | grep default)
|
gateway_iface=$(jq -r '.dev' <<< "${default_route}")
|
||||||
|
log_write " ${gateway_addr}%${gateway_iface}"
|
||||||
|
done < <(ip -j -"${protocol}" route | jq -c '.[] | select(.dst == "default")')
|
||||||
|
|
||||||
|
# Find the first default route
|
||||||
|
default_route=$(ip -j -"${protocol}" route show default)
|
||||||
|
if echo "$default_route" | grep 'gateway' | grep -q 'dev'; then
|
||||||
|
gateway_addr=$(echo "$default_route" | jq -r -c '.[0].gateway')
|
||||||
|
gateway_iface=$(echo "$default_route" | jq -r -c '.[0].dev')
|
||||||
|
else
|
||||||
|
log_write " Unable to determine gateway address for IPv${protocol}"
|
||||||
|
fi
|
||||||
|
|
||||||
gateway_addr=$(ip -"${protocol}" route | grep default | cut -d ' ' -f 3 | head -n 1)
|
|
||||||
gateway_iface=$(ip -"${protocol}" route | grep default | cut -d ' ' -f 5 | head -n 1)
|
|
||||||
# If there was at least one gateway
|
# If there was at least one gateway
|
||||||
if [ -n "${gateway_addr}" ]; then
|
if [ -n "${gateway_addr}" ]; then
|
||||||
# Append the interface to the gateway address if it is a link-local address
|
# Append the interface to the gateway address if it is a link-local address
|
||||||
|
|||||||
+14
-13
@@ -47,7 +47,7 @@ GitCheckUpdateAvail() {
|
|||||||
|
|
||||||
# Fetch latest changes in this repo
|
# Fetch latest changes in this repo
|
||||||
if ! git fetch --quiet origin ; then
|
if ! git fetch --quiet origin ; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Unable to update local repository. Contact Pi-hole Support.${COL_NC}"
|
echo -e "\\n ${COL_RED}Error: Unable to update local repository. Contact Pi-hole Support.${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -76,13 +76,13 @@ GitCheckUpdateAvail() {
|
|||||||
|
|
||||||
|
|
||||||
if [[ "${#LOCAL}" == 0 ]]; then
|
if [[ "${#LOCAL}" == 0 ]]; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Local revision could not be obtained, please contact Pi-hole Support"
|
echo -e "\\n ${COL_RED}Error: Local revision could not be obtained, please contact Pi-hole Support"
|
||||||
echo -e " Additional debugging output:${COL_NC}"
|
echo -e " Additional debugging output:${COL_NC}"
|
||||||
git status
|
git status
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${#REMOTE}" == 0 ]]; then
|
if [[ "${#REMOTE}" == 0 ]]; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Remote revision could not be obtained, please contact Pi-hole Support"
|
echo -e "\\n ${COL_RED}Error: Remote revision could not be obtained, please contact Pi-hole Support"
|
||||||
echo -e " Additional debugging output:${COL_NC}"
|
echo -e " Additional debugging output:${COL_NC}"
|
||||||
git status
|
git status
|
||||||
exit 1
|
exit 1
|
||||||
@@ -103,7 +103,7 @@ GitCheckUpdateAvail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local basicError="\\n ${COL_LIGHT_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
|
local basicError="\\n ${COL_RED}Unable to complete update, please contact Pi-hole Support${COL_NC}"
|
||||||
local core_update
|
local core_update
|
||||||
local web_update
|
local web_update
|
||||||
local FTL_update
|
local FTL_update
|
||||||
@@ -120,7 +120,7 @@ main() {
|
|||||||
|
|
||||||
# This is unlikely
|
# This is unlikely
|
||||||
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
|
if ! is_repo "${PI_HOLE_FILES_DIR}" ; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Core Pi-hole repo is missing from system!"
|
echo -e "\\n ${COL_RED}Error: Core Pi-hole repo is missing from system!"
|
||||||
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
@@ -132,11 +132,11 @@ main() {
|
|||||||
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
|
else
|
||||||
core_update=false
|
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_GREEN}up to date${COL_NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
|
if ! is_repo "${ADMIN_INTERFACE_DIR}" ; then
|
||||||
echo -e "\\n ${COL_LIGHT_RED}Error: Web Admin repo is missing from system!"
|
echo -e "\\n ${COL_RED}Error: Web Admin repo is missing from system!"
|
||||||
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
echo -e " Please re-run install script from https://pi-hole.net${COL_NC}"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
@@ -146,7 +146,7 @@ main() {
|
|||||||
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
|
else
|
||||||
web_update=false
|
web_update=false
|
||||||
echo -e " ${INFO} Web Interface:\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
|
echo -e " ${INFO} Web Interface:\\t${COL_GREEN}up to date${COL_NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local funcOutput
|
local funcOutput
|
||||||
@@ -160,17 +160,18 @@ main() {
|
|||||||
else
|
else
|
||||||
case $? in
|
case $? in
|
||||||
1)
|
1)
|
||||||
echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_GREEN}up to date${COL_NC}"
|
echo -e " ${INFO} FTL:\\t\\t${COL_GREEN}up to date${COL_NC}"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_LIGHT_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
|
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Something has gone wrong, cannot reach download server${COL_NC}"
|
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, cannot reach download server${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e " ${INFO} FTL:\\t\\t${COL_LIGHT_RED}Something has gone wrong, contact support${COL_NC}"
|
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, contact support${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
FTL_update=false
|
FTL_update=false
|
||||||
@@ -187,7 +188,7 @@ main() {
|
|||||||
if [[ ! "${ftlBranch}" == "master" && ! "${ftlBranch}" == "development" ]]; then
|
if [[ ! "${ftlBranch}" == "master" && ! "${ftlBranch}" == "development" ]]; then
|
||||||
# Notify user that they are on a custom branch which might mean they they are lost
|
# Notify user that they are on a custom branch which might mean they they are lost
|
||||||
# behind if a branch was merged to development and got abandoned
|
# behind if a branch was merged to development and got abandoned
|
||||||
printf " %b %bWarning:%b You are using FTL from a custom branch (%s) and might be missing future releases.\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}" "${ftlBranch}"
|
printf " %b %bWarning:%b You are using FTL from a custom branch (%s) and might be missing future releases.\\n" "${INFO}" "${COL_RED}" "${COL_NC}" "${ftlBranch}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${core_update}" == false && "${web_update}" == false && "${FTL_update}" == false ]]; then
|
if [[ "${core_update}" == false && "${web_update}" == false && "${FTL_update}" == false ]]; then
|
||||||
|
|||||||
@@ -173,13 +173,11 @@ if [[ -f "${coltable}" ]]; then
|
|||||||
else
|
else
|
||||||
# Set these values so the installer can still run in color
|
# Set these values so the installer can still run in color
|
||||||
COL_NC='\e[0m' # No Color
|
COL_NC='\e[0m' # No Color
|
||||||
COL_LIGHT_GREEN='\e[1;32m'
|
COL_GREEN='\e[1;32m'
|
||||||
COL_LIGHT_RED='\e[1;31m'
|
COL_RED='\e[1;31m'
|
||||||
TICK="[${COL_LIGHT_GREEN}✓${COL_NC}]"
|
TICK="[${COL_GREEN}✓${COL_NC}]"
|
||||||
CROSS="[${COL_LIGHT_RED}✗${COL_NC}]"
|
CROSS="[${COL_RED}✗${COL_NC}]"
|
||||||
INFO="[i]"
|
INFO="[i]"
|
||||||
# shellcheck disable=SC2034
|
|
||||||
DONE="${COL_LIGHT_GREEN} done!${COL_NC}"
|
|
||||||
OVER="\\r\\033[K"
|
OVER="\\r\\033[K"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -187,13 +185,13 @@ fi
|
|||||||
# This lets users know that it is a Pi-hole, LLC product
|
# This lets users know that it is a Pi-hole, LLC product
|
||||||
show_ascii_berry() {
|
show_ascii_berry() {
|
||||||
echo -e "
|
echo -e "
|
||||||
${COL_LIGHT_GREEN}.;;,.
|
${COL_GREEN}.;;,.
|
||||||
.ccccc:,.
|
.ccccc:,.
|
||||||
:cccclll:. ..,,
|
:cccclll:. ..,,
|
||||||
:ccccclll. ;ooodc
|
:ccccclll. ;ooodc
|
||||||
'ccll:;ll .oooodc
|
'ccll:;ll .oooodc
|
||||||
.;cll.;;looo:.
|
.;cll.;;looo:.
|
||||||
${COL_LIGHT_RED}.. ','.
|
${COL_RED}.. ','.
|
||||||
.',,,,,,'.
|
.',,,,,,'.
|
||||||
.',,,,,,,,,,.
|
.',,,,,,,,,,.
|
||||||
.',,,,,,,,,,,,....
|
.',,,,,,,,,,,,....
|
||||||
@@ -215,7 +213,7 @@ abort() {
|
|||||||
# remove any leftover build directory that may exist
|
# remove any leftover build directory that may exist
|
||||||
rm -rf /tmp/pihole-meta_*
|
rm -rf /tmp/pihole-meta_*
|
||||||
|
|
||||||
echo -e "\\n\\n ${COL_LIGHT_RED}Installation was interrupted${COL_NC}\\n"
|
echo -e "\\n\\n ${COL_RED}Installation was interrupted${COL_NC}\\n"
|
||||||
echo -e "Pi-hole's dependencies might be already installed. If you want to remove them you can try to\\n"
|
echo -e "Pi-hole's dependencies might be already installed. If you want to remove them you can try to\\n"
|
||||||
echo -e "a) run 'pihole uninstall' \\n"
|
echo -e "a) run 'pihole uninstall' \\n"
|
||||||
echo -e "b) Remove the meta-package 'pihole-meta' manually \\n"
|
echo -e "b) Remove the meta-package 'pihole-meta' manually \\n"
|
||||||
@@ -231,6 +229,13 @@ is_command() {
|
|||||||
command -v "${check_command}" >/dev/null 2>&1
|
command -v "${check_command}" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_fresh_install() {
|
||||||
|
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
||||||
|
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
||||||
|
fresh_install=false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Compatibility
|
# Compatibility
|
||||||
package_manager_detect() {
|
package_manager_detect() {
|
||||||
|
|
||||||
@@ -247,8 +252,6 @@ package_manager_detect() {
|
|||||||
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
||||||
# The command we will use to remove packages (used in the uninstaller)
|
# The command we will use to remove packages (used in the uninstaller)
|
||||||
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||||
# Update package cache
|
|
||||||
update_package_cache || exit 1
|
|
||||||
|
|
||||||
# If apt-get is not found, check for rpm.
|
# If apt-get is not found, check for rpm.
|
||||||
elif is_command rpm; then
|
elif is_command rpm; then
|
||||||
@@ -308,7 +311,7 @@ build_dependency_package(){
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf "%b Error: Building pihole-meta.deb failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf "%b Error: Building pihole-meta.deb failed. %b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -341,7 +344,7 @@ build_dependency_package(){
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf "%b Error: Building pihole-meta.rpm failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf "%b Error: Building pihole-meta.rpm failed. %b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -483,7 +486,7 @@ getGitFiles() {
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
# Update the repo, returning an error message on failure
|
# Update the repo, returning an error message on failure
|
||||||
update_repo "${directory}" || {
|
update_repo "${directory}" || {
|
||||||
printf "\\n %b: Could not update local repository. Contact support.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf "\\n %b: Could not update local repository. Contact support.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
# If it's not a .git repo,
|
# If it's not a .git repo,
|
||||||
@@ -492,7 +495,7 @@ getGitFiles() {
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
# Attempt to make the repository, showing an error on failure
|
# Attempt to make the repository, showing an error on failure
|
||||||
make_repo "${directory}" "${remoteRepo}" || {
|
make_repo "${directory}" "${remoteRepo}" || {
|
||||||
printf "\\n %bError: Could not update local repository. Contact support.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf "\\n %bError: Could not update local repository. Contact support.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -577,7 +580,10 @@ Do you wish to continue with an IPv6-only installation?\\n\\n" \
|
|||||||
# Get available interfaces that are UP
|
# Get available interfaces that are UP
|
||||||
get_available_interfaces() {
|
get_available_interfaces() {
|
||||||
# There may be more than one so it's all stored in a variable
|
# There may be more than one so it's all stored in a variable
|
||||||
availableInterfaces=$(ip --oneline link show up | awk '{print $2}' | grep -v "^lo" | cut -d':' -f1 | cut -d'@' -f1)
|
# The ip command list all interfaces that are in the up state
|
||||||
|
# The awk command filters out any interfaces that have the LOOPBACK flag set
|
||||||
|
# while using the characters ": " or "@" as a field separator for awk
|
||||||
|
availableInterfaces=$(ip --oneline link show up | awk -F ': |@' '!/<.*LOOPBACK.*>/ {print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
# A function for displaying the dialogs the user sees when first running the installer
|
# A function for displaying the dialogs the user sees when first running the installer
|
||||||
@@ -807,7 +813,7 @@ setDNS() {
|
|||||||
result=$?
|
result=$?
|
||||||
case ${result} in
|
case ${result} in
|
||||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -844,7 +850,7 @@ If you want to specify a port other than 53, separate it with a hash.\
|
|||||||
result=$?
|
result=$?
|
||||||
case ${result} in
|
case ${result} in
|
||||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||||
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Cancel was selected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -898,7 +904,7 @@ If you want to specify a port other than 53, separate it with a hash.\
|
|||||||
DNSSettingsCorrect=False
|
DNSSettingsCorrect=False
|
||||||
;;
|
;;
|
||||||
"${DIALOG_ESC}")
|
"${DIALOG_ESC}")
|
||||||
printf " %b Escape pressed, exiting installer at DNS Settings%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Escape pressed, exiting installer at DNS Settings%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -949,7 +955,7 @@ setLogging() {
|
|||||||
;;
|
;;
|
||||||
"${DIALOG_ESC}")
|
"${DIALOG_ESC}")
|
||||||
# User pressed <ESC>
|
# User pressed <ESC>
|
||||||
printf " %b Escape pressed, exiting installer at Query Logging choice.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Escape pressed, exiting installer at Query Logging choice.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -974,7 +980,7 @@ setPrivacyLevel() {
|
|||||||
printf " %b Using privacy level: %s\\n" "${INFO}" "${PRIVACY_LEVEL}"
|
printf " %b Using privacy level: %s\\n" "${INFO}" "${PRIVACY_LEVEL}"
|
||||||
;;
|
;;
|
||||||
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
"${DIALOG_CANCEL}" | "${DIALOG_ESC}")
|
||||||
printf " %b Cancelled privacy level selection.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Cancelled privacy level selection.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -1008,7 +1014,7 @@ chooseBlocklists() {
|
|||||||
;;
|
;;
|
||||||
"${DIALOG_ESC}")
|
"${DIALOG_ESC}")
|
||||||
# User pressed <ESC>
|
# User pressed <ESC>
|
||||||
printf " %b Escape pressed, exiting installer at blocklist choice.%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b Escape pressed, exiting installer at blocklist choice.%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -1134,7 +1140,7 @@ installScripts() {
|
|||||||
else
|
else
|
||||||
# Otherwise, show an error and exit
|
# Otherwise, show an error and exit
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf "\\t\\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
printf "\\t\\t%bError: Local repo %s not found, exiting installer%b\\n" "${COL_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1155,7 @@ installConfigs() {
|
|||||||
# Install empty custom.list file if it does not exist
|
# Install empty custom.list file if it does not exist
|
||||||
if [[ ! -r "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" ]]; then
|
if [[ ! -r "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" ]]; then
|
||||||
if ! install -D -T -o pihole -g pihole -m 660 /dev/null "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" &>/dev/null; then
|
if ! install -D -T -o pihole -g pihole -m 660 /dev/null "${PI_HOLE_CONFIG_DIR}/hosts/custom.list" &>/dev/null; then
|
||||||
printf " %b Error: Unable to initialize configuration file %s/custom.list\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}/hosts"
|
printf " %b Error: Unable to initialize configuration file %s/custom.list\\n" "${COL_RED}" "${PI_HOLE_CONFIG_DIR}/hosts"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -1328,7 +1334,7 @@ update_package_cache() {
|
|||||||
UPDATE_PKG_CACHE="apt update"
|
UPDATE_PKG_CACHE="apt update"
|
||||||
fi
|
fi
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b Error: Unable to update package cache. Please try \"%s\"%b\\n" "${COL_LIGHT_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
printf " %b Error: Unable to update package cache. Please try \"%s\"%b\\n" "${COL_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1352,7 @@ notify_package_updates_available() {
|
|||||||
printf "%b %b %s... up to date!\\n\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s... up to date!\\n\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
else
|
else
|
||||||
printf "%b %b %s... %s updates available\\n" "${OVER}" "${TICK}" "${str}" "${updatesToInstall}"
|
printf "%b %b %s... %s updates available\\n" "${OVER}" "${TICK}" "${str}" "${updatesToInstall}"
|
||||||
printf " %b %bIt is recommended to update your OS after installing the Pi-hole!%b\\n\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${COL_NC}"
|
printf " %b %bIt is recommended to update your OS after installing the Pi-hole!%b\\n\\n" "${INFO}" "${COL_GREEN}" "${COL_NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1363,11 +1369,11 @@ install_dependent_packages() {
|
|||||||
rm /tmp/pihole-meta.deb
|
rm /tmp/pihole-meta.deb
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# Install Fedora/CentOS packages
|
# Install Fedora/CentOS packages
|
||||||
@@ -1378,11 +1384,11 @@ install_dependent_packages() {
|
|||||||
rm /tmp/pihole-meta.rpm
|
rm /tmp/pihole-meta.rpm
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1611,13 +1617,13 @@ checkSelinux() {
|
|||||||
if [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -z "${PIHOLE_SELINUX}" ]]; then
|
if [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -z "${PIHOLE_SELINUX}" ]]; then
|
||||||
printf " Pi-hole does not provide an SELinux policy as the required changes modify the security of your system.\\n"
|
printf " Pi-hole does not provide an SELinux policy as the required changes modify the security of your system.\\n"
|
||||||
printf " Please refer to https://wiki.centos.org/HowTos/SELinux if SELinux is required for your deployment.\\n"
|
printf " Please refer to https://wiki.centos.org/HowTos/SELinux if SELinux is required for your deployment.\\n"
|
||||||
printf " This check can be skipped by setting the environment variable %bPIHOLE_SELINUX%b to %btrue%b\\n" "${COL_LIGHT_RED}" "${COL_NC}" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " This check can be skipped by setting the environment variable %bPIHOLE_SELINUX%b to %btrue%b\\n" "${COL_RED}" "${COL_NC}" "${COL_RED}" "${COL_NC}"
|
||||||
printf " e.g: export PIHOLE_SELINUX=true\\n"
|
printf " e.g: export PIHOLE_SELINUX=true\\n"
|
||||||
printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n"
|
printf " By setting this variable to true you acknowledge there may be issues with Pi-hole during or after the install\\n"
|
||||||
printf "\\n %bSELinux Enforcing detected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf "\\n %bSELinux Enforcing detected, exiting installer%b\\n" "${COL_RED}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -n "${PIHOLE_SELINUX}" ]]; then
|
elif [[ "${SELINUX_ENFORCING}" -eq 1 ]] && [[ -n "${PIHOLE_SELINUX}" ]]; then
|
||||||
printf " %b %bSELinux Enforcing detected%b. PIHOLE_SELINUX env variable set - installer will continue\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b %bSELinux Enforcing detected%b. PIHOLE_SELINUX env variable set - installer will continue\\n" "${INFO}" "${COL_RED}" "${COL_NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1715,13 +1721,13 @@ clone_or_reset_repos() {
|
|||||||
# Reset the Core repo
|
# Reset the Core repo
|
||||||
resetRepo ${PI_HOLE_LOCAL_REPO} ||
|
resetRepo ${PI_HOLE_LOCAL_REPO} ||
|
||||||
{
|
{
|
||||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_RED}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
# Reset the Web repo
|
# Reset the Web repo
|
||||||
resetRepo ${webInterfaceDir} ||
|
resetRepo ${webInterfaceDir} ||
|
||||||
{
|
{
|
||||||
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceDir}" "${COL_NC}"
|
printf " %b Unable to reset %s, exiting installer%b\\n" "${COL_RED}" "${webInterfaceDir}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
# Otherwise, a fresh installation is happening
|
# Otherwise, a fresh installation is happening
|
||||||
@@ -1729,13 +1735,13 @@ clone_or_reset_repos() {
|
|||||||
# so get git files for Core
|
# so get git files for Core
|
||||||
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} ||
|
getGitFiles ${PI_HOLE_LOCAL_REPO} ${piholeGitUrl} ||
|
||||||
{
|
{
|
||||||
printf " %b Unable to clone %s into %s, unable to continue%b\\n" "${COL_LIGHT_RED}" "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
printf " %b Unable to clone %s into %s, unable to continue%b\\n" "${COL_RED}" "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
# get the Web git files
|
# get the Web git files
|
||||||
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} ||
|
getGitFiles ${webInterfaceDir} ${webInterfaceGitUrl} ||
|
||||||
{
|
{
|
||||||
printf " %b Unable to clone %s into ${webInterfaceDir}, exiting installer%b\\n" "${COL_LIGHT_RED}" "${webInterfaceGitUrl}" "${COL_NC}"
|
printf " %b Unable to clone %s into ${webInterfaceDir}, exiting installer%b\\n" "${COL_RED}" "${webInterfaceGitUrl}" "${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -1811,7 +1817,7 @@ FTLinstall() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
printf " %b Error: Download of %s/%s failed (checksum error)%b\\n" "${COL_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||||
|
|
||||||
# Remove temp dir
|
# Remove temp dir
|
||||||
remove_dir "${tempdir}"
|
remove_dir "${tempdir}"
|
||||||
@@ -1825,7 +1831,7 @@ FTLinstall() {
|
|||||||
}
|
}
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
# The URL could not be found
|
# The URL could not be found
|
||||||
printf " %b Error: URL %s/%s not found%b\\n" "${COL_LIGHT_RED}" "${url}" "${binary}" "${COL_NC}"
|
printf " %b Error: URL %s/%s not found%b\\n" "${COL_RED}" "${url}" "${binary}" "${COL_NC}"
|
||||||
|
|
||||||
# Remove temp dir
|
# Remove temp dir
|
||||||
remove_dir "${tempdir}"
|
remove_dir "${tempdir}"
|
||||||
@@ -1902,7 +1908,7 @@ get_binary_name() {
|
|||||||
# Something else - we try to use 32bit executable and warn the user
|
# Something else - we try to use 32bit executable and warn the user
|
||||||
if [[ ! "${machine}" == "i686" ]]; then
|
if [[ ! "${machine}" == "i686" ]]; then
|
||||||
printf "%b %b %s...\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s...\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %b %bNot able to detect architecture (unknown: %s), trying x86 (32bit) executable%b\\n" "${INFO}" "${COL_LIGHT_RED}" "${machine}" "${COL_NC}"
|
printf " %b %bNot able to detect architecture (unknown: %s), trying x86 (32bit) executable%b\\n" "${INFO}" "${COL_RED}" "${machine}" "${COL_NC}"
|
||||||
printf " %b Contact Pi-hole Support if you experience issues (e.g: FTL not running)\\n" "${INFO}"
|
printf " %b Contact Pi-hole Support if you experience issues (e.g: FTL not running)\\n" "${INFO}"
|
||||||
else
|
else
|
||||||
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
|
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
|
||||||
@@ -1940,12 +1946,12 @@ FTLcheckUpdate() {
|
|||||||
path="${ftlBranch}/${binary}"
|
path="${ftlBranch}/${binary}"
|
||||||
|
|
||||||
# Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
|
# Check whether or not the binary for this FTL branch actually exists. If not, then there is no update!
|
||||||
if ! check_download_exists "$path"; then
|
|
||||||
local status
|
local status
|
||||||
|
if ! check_download_exists "$path"; then
|
||||||
status=$?
|
status=$?
|
||||||
if [ "${status}" -eq 1 ]; then
|
if [ "${status}" -eq 1 ]; then
|
||||||
printf " %b Branch \"%s\" is not available.\\n" "${INFO}" "${ftlBranch}"
|
printf " %b Branch \"%s\" is not available.\\n" "${INFO}" "${ftlBranch}"
|
||||||
printf " %b Use %bpihole checkout ftl [branchname]%b to switch to a valid branch.\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${COL_NC}"
|
printf " %b Use %bpihole checkout ftl [branchname]%b to switch to a valid branch.\\n" "${INFO}" "${COL_GREEN}" "${COL_NC}"
|
||||||
elif [ "${status}" -eq 2 ]; then
|
elif [ "${status}" -eq 2 ]; then
|
||||||
printf " %b Unable to download from ftl.pi-hole.net. Please check your Internet connection and try again later.\\n" "${CROSS}"
|
printf " %b Unable to download from ftl.pi-hole.net. Please check your Internet connection and try again later.\\n" "${CROSS}"
|
||||||
return 3
|
return 3
|
||||||
@@ -2031,6 +2037,11 @@ FTLdetect() {
|
|||||||
|
|
||||||
if FTLcheckUpdate "${1}"; then
|
if FTLcheckUpdate "${1}"; then
|
||||||
FTLinstall "${1}" || return 1
|
FTLinstall "${1}" || return 1
|
||||||
|
else
|
||||||
|
case $? in
|
||||||
|
1) :;; # FTL is up-to-date
|
||||||
|
*) exit 1;; # 404 (2), other HTTP or curl error (3), unknown (4)
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2158,7 +2169,7 @@ main() {
|
|||||||
else
|
else
|
||||||
# Otherwise, they do not have enough privileges, so let the user know
|
# Otherwise, they do not have enough privileges, so let the user know
|
||||||
printf " %b %s\\n" "${INFO}" "${str}"
|
printf " %b %s\\n" "${INFO}" "${str}"
|
||||||
printf " %b %bScript called with non-root privileges%b\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}"
|
printf " %b %bScript called with non-root privileges%b\\n" "${INFO}" "${COL_RED}" "${COL_NC}"
|
||||||
printf " The Pi-hole requires elevated privileges to install and run\\n"
|
printf " The Pi-hole requires elevated privileges to install and run\\n"
|
||||||
printf " Please check the installer for any concerns regarding this requirement\\n"
|
printf " Please check the installer for any concerns regarding this requirement\\n"
|
||||||
printf " Make sure to download this script from a trusted source\\n\\n"
|
printf " Make sure to download this script from a trusted source\\n\\n"
|
||||||
@@ -2182,7 +2193,7 @@ main() {
|
|||||||
# Otherwise, tell the user they need to run the script as root, and bail
|
# Otherwise, tell the user they need to run the script as root, and bail
|
||||||
printf "%b %b Sudo utility check\\n" "${OVER}" "${CROSS}"
|
printf "%b %b Sudo utility check\\n" "${OVER}" "${CROSS}"
|
||||||
printf " %b Sudo is needed for the Web Interface to run pihole commands\\n\\n" "${INFO}"
|
printf " %b Sudo is needed for the Web Interface to run pihole commands\\n\\n" "${INFO}"
|
||||||
printf " %b %bPlease re-run this installer as root${COL_NC}\\n" "${INFO}" "${COL_LIGHT_RED}"
|
printf " %b %bPlease re-run this installer as root${COL_NC}\\n" "${INFO}" "${COL_RED}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -2193,9 +2204,17 @@ main() {
|
|||||||
# Check for availability of either the "service" or "systemctl" commands
|
# Check for availability of either the "service" or "systemctl" commands
|
||||||
check_service_command
|
check_service_command
|
||||||
|
|
||||||
|
# Check if this is a fresh install or an update/repair
|
||||||
|
check_fresh_install
|
||||||
|
|
||||||
# Check for supported package managers so that we may install dependencies
|
# Check for supported package managers so that we may install dependencies
|
||||||
package_manager_detect
|
package_manager_detect
|
||||||
|
|
||||||
|
# Update package cache only on apt based systems
|
||||||
|
if is_command apt-get; then
|
||||||
|
update_package_cache || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Notify user of package availability
|
# Notify user of package availability
|
||||||
notify_package_updates_available
|
notify_package_updates_available
|
||||||
|
|
||||||
@@ -2216,10 +2235,7 @@ main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# in case of an update (can be a v5 -> v6 or v6 -> v6 update) or repair
|
if [[ "${fresh_install}" == false ]]; then
|
||||||
if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
|
|
||||||
# retain settings
|
|
||||||
fresh_install=false
|
|
||||||
# if it's running unattended,
|
# if it's running unattended,
|
||||||
if [[ "${runUnattended}" == true ]]; then
|
if [[ "${runUnattended}" == true ]]; then
|
||||||
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
||||||
@@ -2367,8 +2383,10 @@ main() {
|
|||||||
printf " %b If you have not done so already, the above IP should be set to static.\\n" "${INFO}"
|
printf " %b If you have not done so already, the above IP should be set to static.\\n" "${INFO}"
|
||||||
|
|
||||||
printf " %b View the web interface at http://pi.hole:${WEBPORT}/admin or http://%s/admin\\n\\n" "${INFO}" "${IPV4_ADDRESS%/*}:${WEBPORT}"
|
printf " %b View the web interface at http://pi.hole:${WEBPORT}/admin or http://%s/admin\\n\\n" "${INFO}" "${IPV4_ADDRESS%/*}:${WEBPORT}"
|
||||||
printf " %b Web Interface password: %b%s%b\\n" "${INFO}" "${COL_LIGHT_GREEN}" "${pw}" "${COL_NC}"
|
printf " %b Web Interface password: %b%s%b\\n" "${INFO}" "${COL_GREEN}" "${pw}" "${COL_NC}"
|
||||||
printf " %b This can be changed using 'pihole setpassword'\\n\\n" "${INFO}"
|
printf " %b This can be changed using 'pihole setpassword'\\n\\n" "${INFO}"
|
||||||
|
printf " %b To allow your user to use all CLI functions without authentication, refer to\\n" "${INFO}"
|
||||||
|
printf " our documentation at: https://docs.pi-hole.net/main/post-install/\\n\\n"
|
||||||
|
|
||||||
# Final dialog message to the user
|
# Final dialog message to the user
|
||||||
dialog --no-shadow --keep-tite \
|
dialog --no-shadow --keep-tite \
|
||||||
@@ -2377,7 +2395,11 @@ main() {
|
|||||||
\\n\\nIPv4: ${IPV4_ADDRESS%/*}\
|
\\n\\nIPv4: ${IPV4_ADDRESS%/*}\
|
||||||
\\nIPv6: ${IPV6_ADDRESS:-"Not Configured"}\
|
\\nIPv6: ${IPV6_ADDRESS:-"Not Configured"}\
|
||||||
\\nIf you have not done so already, the above IP should be set to static.\
|
\\nIf you have not done so already, the above IP should be set to static.\
|
||||||
\\nView the web interface at http://pi.hole/admin:${WEBPORT} or http://${IPV4_ADDRESS%/*}:${WEBPORT}/admin\\n\\nYour Admin Webpage login password is ${pw}" "${r}" "${c}"
|
\\nView the web interface at http://pi.hole/admin:${WEBPORT} or http://${IPV4_ADDRESS%/*}:${WEBPORT}/admin\\n\\nYour Admin Webpage login password is ${pw}\
|
||||||
|
\\n
|
||||||
|
\\n
|
||||||
|
\\nTo allow your user to use all CLI functions without authentication,\
|
||||||
|
\\nrefer to https://docs.pi-hole.net/main/post-install/" "${r}" "${c}"
|
||||||
|
|
||||||
INSTALL_TYPE="Installation"
|
INSTALL_TYPE="Installation"
|
||||||
else
|
else
|
||||||
@@ -2386,7 +2408,7 @@ main() {
|
|||||||
|
|
||||||
# Display where the log file is
|
# Display where the log file is
|
||||||
printf "\\n %b The install log is located at: %s\\n" "${INFO}" "${installLogLoc}"
|
printf "\\n %b The install log is located at: %s\\n" "${INFO}" "${installLogLoc}"
|
||||||
printf " %b %b%s complete! %b\\n" "${TICK}" "${COL_LIGHT_GREEN}" "${INSTALL_TYPE}" "${COL_NC}"
|
printf " %b %b%s complete! %b\\n" "${TICK}" "${COL_GREEN}" "${INSTALL_TYPE}" "${COL_NC}"
|
||||||
|
|
||||||
if [[ "${INSTALL_TYPE}" == "Update" ]]; then
|
if [[ "${INSTALL_TYPE}" == "Update" ]]; then
|
||||||
printf "\\n"
|
printf "\\n"
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfig
|
|||||||
readonly ADMIN_INTERFACE_DIR
|
readonly ADMIN_INTERFACE_DIR
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -rp " ${QST} Are you sure you would like to remove ${COL_WHITE}Pi-hole${COL_NC}? [y/N] " answer
|
read -rp " ${QST} Are you sure you would like to remove ${COL_BOLD}Pi-hole${COL_NC}? [y/N] " answer
|
||||||
case ${answer} in
|
case ${answer} in
|
||||||
[Yy]* ) break;;
|
[Yy]* ) break;;
|
||||||
* ) echo -e "${OVER} ${COL_LIGHT_GREEN}Uninstall has been canceled${COL_NC}"; exit 0;;
|
* ) echo -e "${OVER} ${COL_GREEN}Uninstall has been canceled${COL_NC}"; exit 0;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -150,11 +150,11 @@ removePiholeFiles() {
|
|||||||
|
|
||||||
echo -e "\\n We're sorry to see you go, but thanks for checking out Pi-hole!
|
echo -e "\\n We're sorry to see you go, but thanks for checking out Pi-hole!
|
||||||
If you need help, reach out to us on GitHub, Discourse, Reddit or Twitter
|
If you need help, reach out to us on GitHub, Discourse, Reddit or Twitter
|
||||||
Reinstall at any time: ${COL_WHITE}curl -sSL https://install.pi-hole.net | bash${COL_NC}
|
Reinstall at any time: ${COL_BOLD}curl -sSL https://install.pi-hole.net | bash${COL_NC}
|
||||||
|
|
||||||
${COL_LIGHT_RED}Please reset the DNS on your router/clients to restore internet connectivity${COL_NC}
|
${COL_RED}Please reset the DNS on your router/clients to restore internet connectivity${COL_NC}
|
||||||
${INFO} Pi-hole's meta package has been removed, use the 'autoremove' function from your package manager to remove unused dependencies${COL_NC}
|
${INFO} Pi-hole's meta package has been removed, use the 'autoremove' function from your package manager to remove unused dependencies${COL_NC}
|
||||||
${COL_LIGHT_GREEN}Uninstallation Complete! ${COL_NC}"
|
${COL_GREEN}Uninstallation Complete! ${COL_NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
######### SCRIPT ###########
|
######### SCRIPT ###########
|
||||||
|
|||||||
+16
-12
@@ -50,7 +50,7 @@ etag_support=false
|
|||||||
|
|
||||||
# Check gravity temp directory
|
# Check gravity temp directory
|
||||||
if [ ! -d "${GRAVITY_TMPDIR}" ] || [ ! -w "${GRAVITY_TMPDIR}" ]; then
|
if [ ! -d "${GRAVITY_TMPDIR}" ] || [ ! -w "${GRAVITY_TMPDIR}" ]; then
|
||||||
echo -e " ${COL_LIGHT_RED}Gravity temporary directory does not exist or is not a writeable directory, falling back to /tmp. ${COL_NC}"
|
echo -e " ${COL_RED}Gravity temporary directory does not exist or is not a writeable directory, falling back to /tmp. ${COL_NC}"
|
||||||
GRAVITY_TMPDIR="/tmp"
|
GRAVITY_TMPDIR="/tmp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -608,8 +608,10 @@ compareLists() {
|
|||||||
# Download specified URL and perform checks on HTTP status and file content
|
# Download specified URL and perform checks on HTTP status and file content
|
||||||
gravity_DownloadBlocklistFromUrl() {
|
gravity_DownloadBlocklistFromUrl() {
|
||||||
local url="${1}" adlistID="${2}" saveLocation="${3}" compression="${4}" gravity_type="${5}" domain="${6}"
|
local url="${1}" adlistID="${2}" saveLocation="${3}" compression="${4}" gravity_type="${5}" domain="${6}"
|
||||||
local modifiedOptions="" listCurlBuffer str httpCode success="" ip cmd_ext
|
local listCurlBuffer str httpCode success="" ip customUpstreamResolver=""
|
||||||
local file_path permissions ip_addr port blocked=false download=true
|
local file_path permissions ip_addr port blocked=false download=true
|
||||||
|
# modifiedOptions is an array to store all the options used to check if the adlist has been changed upstream
|
||||||
|
local modifiedOptions=()
|
||||||
|
|
||||||
# Create temp file to store content on disk instead of RAM
|
# Create temp file to store content on disk instead of RAM
|
||||||
# We don't use '--suffix' here because not all implementations of mktemp support it, e.g. on Alpine
|
# We don't use '--suffix' here because not all implementations of mktemp support it, e.g. on Alpine
|
||||||
@@ -626,14 +628,14 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
# Save HTTP ETag to the specified file. An ETag is a caching related header,
|
# Save HTTP ETag to the specified file. An ETag is a caching related header,
|
||||||
# usually returned in a response. If no ETag is sent by the server, an empty
|
# usually returned in a response. If no ETag is sent by the server, an empty
|
||||||
# file is created and can later be used consistently.
|
# file is created and can later be used consistently.
|
||||||
modifiedOptions="--etag-save ${saveLocation}.etag"
|
modifiedOptions=("${modifiedOptions[@]}" --etag-save "${saveLocation}".etag)
|
||||||
|
|
||||||
if [[ -f "${saveLocation}.etag" ]]; then
|
if [[ -f "${saveLocation}.etag" ]]; then
|
||||||
# This option makes a conditional HTTP request for the specific ETag read
|
# This option makes a conditional HTTP request for the specific ETag read
|
||||||
# from the given file by sending a custom If-None-Match header using the
|
# from the given file by sending a custom If-None-Match header using the
|
||||||
# stored ETag. This way, the server will only send the file if it has
|
# stored ETag. This way, the server will only send the file if it has
|
||||||
# changed since the last request.
|
# changed since the last request.
|
||||||
modifiedOptions="${modifiedOptions} --etag-compare ${saveLocation}.etag"
|
modifiedOptions=("${modifiedOptions[@]}" --etag-compare "${saveLocation}".etag)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -646,7 +648,7 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
# Interstingly, this option is not supported by raw.githubusercontent.com
|
# Interstingly, this option is not supported by raw.githubusercontent.com
|
||||||
# URLs, however, it is still supported by many older web servers which may
|
# URLs, however, it is still supported by many older web servers which may
|
||||||
# not support the HTTP ETag method so we keep it as a fallback.
|
# not support the HTTP ETag method so we keep it as a fallback.
|
||||||
modifiedOptions="${modifiedOptions} -z ${saveLocation}"
|
modifiedOptions=("${modifiedOptions[@]}" -z "${saveLocation}")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -712,7 +714,7 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
fi
|
fi
|
||||||
echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by one of your lists. Using DNS server ${upstream} instead"
|
echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by one of your lists. Using DNS server ${upstream} instead"
|
||||||
echo -ne " ${INFO} ${str} Pending..."
|
echo -ne " ${INFO} ${str} Pending..."
|
||||||
cmd_ext="--resolve $domain:$port:$ip"
|
customUpstreamResolver="--resolve $domain:$port:$ip"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -750,9 +752,7 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${download}" == true ]]; then
|
if [[ "${download}" == true ]]; then
|
||||||
# See https://github.com/pi-hole/pi-hole/issues/6159 for justification of the below disable directive
|
httpCode=$(curl --connect-timeout ${curl_connect_timeout} -s -L ${compression:+${compression}} ${customUpstreamResolver:+${customUpstreamResolver}} "${modifiedOptions[@]}" -w "%{http_code}" "${url}" -o "${listCurlBuffer}" 2>/dev/null)
|
||||||
# shellcheck disable=SC2086
|
|
||||||
httpCode=$(curl --connect-timeout ${curl_connect_timeout} -s -L ${compression} ${cmd_ext} ${modifiedOptions} -w "%{http_code}" "${url}" -o "${listCurlBuffer}" 2>/dev/null)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $url in
|
case $url in
|
||||||
@@ -808,6 +808,10 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
fix_owner_permissions "${saveLocation}"
|
fix_owner_permissions "${saveLocation}"
|
||||||
# Compare lists if they are identical
|
# Compare lists if they are identical
|
||||||
compareLists "${adlistID}" "${saveLocation}"
|
compareLists "${adlistID}" "${saveLocation}"
|
||||||
|
# Set permissions for the *.etag file
|
||||||
|
if [[ -f "${saveLocation}.etag" ]]; then
|
||||||
|
fix_owner_permissions "${saveLocation}.etag"
|
||||||
|
fi
|
||||||
# Add domains to database table file
|
# Add domains to database table file
|
||||||
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
||||||
done="true"
|
done="true"
|
||||||
@@ -821,13 +825,13 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
if [[ "${done}" != "true" ]]; then
|
if [[ "${done}" != "true" ]]; then
|
||||||
# Determine if cached list has read permission
|
# Determine if cached list has read permission
|
||||||
if [[ -r "${saveLocation}" ]]; then
|
if [[ -r "${saveLocation}" ]]; then
|
||||||
echo -e " ${CROSS} List download failed: ${COL_LIGHT_GREEN}using previously cached list${COL_NC}"
|
echo -e " ${CROSS} List download failed: ${COL_GREEN}using previously cached list${COL_NC}"
|
||||||
# Set list status to "download-failed/cached"
|
# Set list status to "download-failed/cached"
|
||||||
database_adlist_status "${adlistID}" "3"
|
database_adlist_status "${adlistID}" "3"
|
||||||
# Add domains to database table file
|
# Add domains to database table file
|
||||||
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} List download failed: ${COL_LIGHT_RED}no cached list available${COL_NC}"
|
echo -e " ${CROSS} List download failed: ${COL_RED}no cached list available${COL_NC}"
|
||||||
# Manually reset these two numbers because we do not call parseList here
|
# Manually reset these two numbers because we do not call parseList here
|
||||||
database_adlist_number "${adlistID}" 0 0
|
database_adlist_number "${adlistID}" 0 0
|
||||||
database_adlist_status "${adlistID}" "4"
|
database_adlist_status "${adlistID}" "4"
|
||||||
@@ -864,7 +868,7 @@ gravity_ShowCount() {
|
|||||||
|
|
||||||
# Trap Ctrl-C
|
# Trap Ctrl-C
|
||||||
gravity_Trap() {
|
gravity_Trap() {
|
||||||
trap '{ echo -e "\\n\\n ${INFO} ${COL_LIGHT_RED}User-abort detected${COL_NC}"; gravity_Cleanup "error"; }' INT
|
trap '{ echo -e "\\n\\n ${INFO} ${COL_RED}User-abort detected${COL_NC}"; gravity_Cleanup "error"; }' INT
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up after Gravity upon exit or cancellation
|
# Clean up after Gravity upon exit or cancellation
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# This file is copyright under the latest version of the EUPL.
|
# This file is copyright under the latest version of the EUPL.
|
||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
|
|
||||||
# PI_HOLE_BIN_DIR is not readonly here because in some functions (checkout),
|
# PI_HOLE_BIN_DIR is not readonly here because in some functions (checkout),
|
||||||
# they might get set again when the installer is sourced. This causes an
|
# they might get set again when the installer is sourced. This causes an
|
||||||
@@ -20,7 +20,7 @@ readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
|||||||
# shellcheck source=./advanced/Scripts/COL_TABLE
|
# shellcheck source=./advanced/Scripts/COL_TABLE
|
||||||
source "${colfile}"
|
source "${colfile}"
|
||||||
|
|
||||||
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck source=./advanced/Scripts/utils.sh
|
# shellcheck source=./advanced/Scripts/utils.sh
|
||||||
source "${utilsfile}"
|
source "${utilsfile}"
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ Time:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${error} == true ]];then
|
if [[ ${error} == true ]];then
|
||||||
echo -e " ${COL_LIGHT_RED}Unknown format for blocking timer!${COL_NC}"
|
echo -e " ${COL_RED}Unknown format for blocking timer!${COL_NC}"
|
||||||
echo -e " Try 'pihole disable --help' for more information."
|
echo -e " Try 'pihole disable --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -293,7 +293,7 @@ Options:
|
|||||||
echo -e " ${INFO} Enabling logging..."
|
echo -e " ${INFO} Enabling logging..."
|
||||||
local str="Logging has been enabled!"
|
local str="Logging has been enabled!"
|
||||||
else
|
else
|
||||||
echo -e " ${COL_LIGHT_RED}Invalid option${COL_NC}
|
echo -e " ${COL_RED}Invalid option${COL_NC}
|
||||||
Try 'pihole logging --help' for more information."
|
Try 'pihole logging --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -396,7 +396,7 @@ tailFunc() {
|
|||||||
# Color blocklist/denylist/wildcard entries as red
|
# Color blocklist/denylist/wildcard entries as red
|
||||||
# Color A/AAAA/DHCP strings as white
|
# Color A/AAAA/DHCP strings as white
|
||||||
# Color everything else as gray
|
# Color everything else as gray
|
||||||
tail -f $LOGFILE | grep --line-buffered "${1}" | sed -E \
|
tail -f $LOGFILE | grep --line-buffered -- "${1}" | sed -E \
|
||||||
-e "s,($(date +'%b %d ')| dnsmasq\[[0-9]*\]),,g" \
|
-e "s,($(date +'%b %d ')| dnsmasq\[[0-9]*\]),,g" \
|
||||||
-e "s,(.*(denied |gravity blocked ).*),${COL_RED}&${COL_NC}," \
|
-e "s,(.*(denied |gravity blocked ).*),${COL_RED}&${COL_NC}," \
|
||||||
-e "s,.*(query\\[A|DHCP).*,${COL_NC}&${COL_NC}," \
|
-e "s,.*(query\\[A|DHCP).*,${COL_NC}&${COL_NC}," \
|
||||||
@@ -552,7 +552,7 @@ case "${1}" in
|
|||||||
"enable" ) need_root=0;;
|
"enable" ) need_root=0;;
|
||||||
"disable" ) need_root=0;;
|
"disable" ) need_root=0;;
|
||||||
"-d" | "debug" ) ;;
|
"-d" | "debug" ) ;;
|
||||||
"-g" | "updateGravity" ) ;;
|
"-g" | "updateGravity" ) need_root=0;;
|
||||||
"reloaddns" ) ;;
|
"reloaddns" ) ;;
|
||||||
"reloadlists" ) ;;
|
"reloadlists" ) ;;
|
||||||
"setpassword" ) ;;
|
"setpassword" ) ;;
|
||||||
@@ -570,9 +570,9 @@ if [[ -z ${USER} ]]; then
|
|||||||
USER=$(whoami)
|
USER=$(whoami)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the current user is neither root nor pihole and if the command
|
# Check if the current user is not root and if the command
|
||||||
# requires root. If so, exit with an error message.
|
# requires root. If so, exit with an error message.
|
||||||
if [[ $EUID -ne 0 && ${USER} != "pihole" && need_root -eq 1 ]];then
|
if [[ $EUID -ne 0 && need_root -eq 1 ]];then
|
||||||
echo -e " ${CROSS} The Pi-hole command requires root privileges, try:"
|
echo -e " ${CROSS} The Pi-hole command requires root privileges, try:"
|
||||||
echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}"
|
echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pyyaml == 6.0.2
|
pyyaml == 6.0.2
|
||||||
pytest == 8.3.5
|
pytest == 8.4.1
|
||||||
pytest-xdist == 3.6.1
|
pytest-xdist == 3.8.0
|
||||||
pytest-testinfra == 10.2.2
|
pytest-testinfra == 10.2.2
|
||||||
tox == 4.26.0
|
tox == 4.27.0
|
||||||
pytest-clarity == 1.0.1
|
pytest-clarity == 1.0.1
|
||||||
|
|||||||
@@ -89,10 +89,8 @@ def test_installPihole_fresh_install_readableFiles(host):
|
|||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
umask 0027
|
umask 0027
|
||||||
runUnattended=true
|
runUnattended=true
|
||||||
fresh_install=false
|
|
||||||
source /opt/pihole/basic-install.sh > /dev/null
|
source /opt/pihole/basic-install.sh > /dev/null
|
||||||
runUnattended=true
|
runUnattended=true
|
||||||
fresh_install=false
|
|
||||||
main
|
main
|
||||||
/opt/pihole/pihole-FTL-prestart.sh
|
/opt/pihole/pihole-FTL-prestart.sh
|
||||||
"""
|
"""
|
||||||
@@ -473,6 +471,7 @@ def test_package_manager_has_pihole_deps(host):
|
|||||||
"""
|
"""
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
package_manager_detect
|
package_manager_detect
|
||||||
|
update_package_cache
|
||||||
build_dependency_package
|
build_dependency_package
|
||||||
install_dependent_packages
|
install_dependent_packages
|
||||||
"""
|
"""
|
||||||
@@ -489,6 +488,7 @@ def test_meta_package_uninstall(host):
|
|||||||
"""
|
"""
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
package_manager_detect
|
package_manager_detect
|
||||||
|
update_package_cache
|
||||||
build_dependency_package
|
build_dependency_package
|
||||||
install_dependent_packages
|
install_dependent_packages
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user