mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-07-28 16:14:07 +02:00
Shellcheck Tweaks (#6147)
This commit is contained in:
commit
36e6c9921e
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
check_together: 'yes'
|
check_together: 'yes'
|
||||||
format: tty
|
format: tty
|
||||||
severity: error
|
severity: warning
|
||||||
|
|
||||||
- name: Spell-Checking
|
- name: Spell-Checking
|
||||||
uses: codespell-project/actions-codespell@master
|
uses: codespell-project/actions-codespell@master
|
||||||
|
1
.shellcheckrc
Normal file
1
.shellcheckrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
disable=SC1090,SC1091 # Ignore warnings about being unable to follow sourced files
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
# (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||||
@ -13,9 +13,8 @@
|
|||||||
readonly scriptPath="/etc/.pihole/advanced/Scripts/database_migration/gravity"
|
readonly scriptPath="/etc/.pihole/advanced/Scripts/database_migration/gravity"
|
||||||
|
|
||||||
upgrade_gravityDB(){
|
upgrade_gravityDB(){
|
||||||
local database piholeDir version
|
local database version
|
||||||
database="${1}"
|
database="${1}"
|
||||||
piholeDir="${2}"
|
|
||||||
|
|
||||||
# Exit early if the database does not exist (e.g. in CI tests)
|
# Exit early if the database does not exist (e.g. in CI tests)
|
||||||
if [[ ! -f "${database}" ]]; then
|
if [[ ! -f "${database}" ]]; then
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
# (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
# Please see LICENSE file for your rights under this license.
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
SKIP_INSTALL="true"
|
SKIP_INSTALL="true"
|
||||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ checkout() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
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_LIGHT_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}"
|
||||||
@ -103,13 +105,14 @@ checkout() {
|
|||||||
echo "master" > /etc/pihole/ftlbranch
|
echo "master" > /etc/pihole/ftlbranch
|
||||||
chmod 644 /etc/pihole/ftlbranch
|
chmod 644 /etc/pihole/ftlbranch
|
||||||
elif [[ "${1}" == "core" ]] ; then
|
elif [[ "${1}" == "core" ]] ; then
|
||||||
|
# shellcheck disable=SC2154
|
||||||
str="Fetching branches from ${piholeGitUrl}"
|
str="Fetching branches from ${piholeGitUrl}"
|
||||||
echo -ne " ${INFO} $str"
|
echo -ne " ${INFO} $str"
|
||||||
if ! fully_fetch_repo "${PI_HOLE_FILES_DIR}" ; then
|
if ! fully_fetch_repo "${PI_HOLE_FILES_DIR}" ; then
|
||||||
echo -e "${OVER} ${CROSS} $str"
|
echo -e "${OVER} ${CROSS} $str"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
corebranches=($(get_available_branches "${PI_HOLE_FILES_DIR}"))
|
mapfile -t corebranches < <(get_available_branches "${PI_HOLE_FILES_DIR}")
|
||||||
|
|
||||||
if [[ "${corebranches[*]}" == *"master"* ]]; then
|
if [[ "${corebranches[*]}" == *"master"* ]]; then
|
||||||
echo -e "${OVER} ${TICK} $str"
|
echo -e "${OVER} ${TICK} $str"
|
||||||
@ -130,13 +133,14 @@ checkout() {
|
|||||||
fi
|
fi
|
||||||
checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${2}"
|
checkout_pull_branch "${PI_HOLE_FILES_DIR}" "${2}"
|
||||||
elif [[ "${1}" == "web" ]] ; then
|
elif [[ "${1}" == "web" ]] ; then
|
||||||
|
# shellcheck disable=SC2154
|
||||||
str="Fetching branches from ${webInterfaceGitUrl}"
|
str="Fetching branches from ${webInterfaceGitUrl}"
|
||||||
echo -ne " ${INFO} $str"
|
echo -ne " ${INFO} $str"
|
||||||
if ! fully_fetch_repo "${webInterfaceDir}" ; then
|
if ! fully_fetch_repo "${webInterfaceDir}" ; then
|
||||||
echo -e "${OVER} ${CROSS} $str"
|
echo -e "${OVER} ${CROSS} $str"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
webbranches=($(get_available_branches "${webInterfaceDir}"))
|
mapfile -t webbranches < <(get_available_branches "${webInterfaceDir}")
|
||||||
|
|
||||||
if [[ "${webbranches[*]}" == *"master"* ]]; then
|
if [[ "${webbranches[*]}" == *"master"* ]]; then
|
||||||
echo -e "${OVER} ${TICK} $str"
|
echo -e "${OVER} ${TICK} $str"
|
||||||
@ -167,7 +171,7 @@ checkout() {
|
|||||||
|
|
||||||
# Check if requested branch is available
|
# Check if requested branch is available
|
||||||
echo -e " ${INFO} Checking for availability of branch ${COL_CYAN}${2}${COL_NC} on GitHub"
|
echo -e " ${INFO} Checking for availability of branch ${COL_CYAN}${2}${COL_NC} on GitHub"
|
||||||
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep "refs/heads" | cut -d'/' -f3- -) )
|
mapfile -t ftlbranches < <(git ls-remote https://github.com/pi-hole/ftl | grep "refs/heads" | cut -d'/' -f3- -)
|
||||||
# If returned array is empty -> connectivity issue
|
# If returned array is empty -> connectivity issue
|
||||||
if [[ ${#ftlbranches[@]} -eq 0 ]]; then
|
if [[ ${#ftlbranches[@]} -eq 0 ]]; then
|
||||||
echo -e " ${CROSS} Unable to fetch branches from GitHub. Please check your Internet connection and try again later."
|
echo -e " ${CROSS} Unable to fetch branches from GitHub. Please check your Internet connection and try again later."
|
||||||
@ -209,13 +213,15 @@ checkout() {
|
|||||||
# Update local and remote versions via updatechecker
|
# Update local and remote versions via updatechecker
|
||||||
/opt/pihole/updatecheck.sh
|
/opt/pihole/updatecheck.sh
|
||||||
else
|
else
|
||||||
if [ $? -eq 1 ]; then
|
local status
|
||||||
|
status=$?
|
||||||
|
if [ $status -eq 1 ]; then
|
||||||
# Binary for requested branch is not available, may still be
|
# Binary for requested branch is not available, may still be
|
||||||
# int he process of being built or CI build job failed
|
# int he process of being built or CI build job failed
|
||||||
printf " %b Binary for requested branch is not available, please try again later.\\n" ${CROSS}
|
printf " %b Binary for requested branch is not available, please try again later.\\n" ${CROSS}
|
||||||
printf " If the issue persists, please contact Pi-hole Support and ask them to re-generate the binary.\\n"
|
printf " If the issue persists, please contact Pi-hole Support and ask them to re-generate the binary.\\n"
|
||||||
exit 1
|
exit 1
|
||||||
elif [ $? -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}"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Ignore warning about `local` being undefinded in POSIX
|
# Ignore warning about `local` being undefinded in POSIX
|
||||||
# shellcheck disable=SC3043
|
# shellcheck disable=SC3043
|
||||||
|
@ -21,7 +21,6 @@ SKIP_INSTALL=true
|
|||||||
# when --check-only is passed to this script, it will not perform the actual update
|
# when --check-only is passed to this script, it will not perform the actual update
|
||||||
CHECK_ONLY=false
|
CHECK_ONLY=false
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source "/opt/pihole/COL_TABLE"
|
source "/opt/pihole/COL_TABLE"
|
||||||
@ -36,7 +35,8 @@ source "${PI_HOLE_INSTALL_DIR}/utils.sh"
|
|||||||
# getFTLConfigValue() sourced from utils.sh
|
# getFTLConfigValue() sourced from utils.sh
|
||||||
|
|
||||||
# Honour configured paths for the web application.
|
# Honour configured paths for the web application.
|
||||||
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
readonly ADMIN_INTERFACE_DIR
|
||||||
|
|
||||||
GitCheckUpdateAvail() {
|
GitCheckUpdateAvail() {
|
||||||
local directory
|
local directory
|
||||||
|
@ -42,7 +42,8 @@ function get_remote_hash() {
|
|||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /opt/pihole/utils.sh
|
. /opt/pihole/utils.sh
|
||||||
|
|
||||||
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
readonly ADMIN_INTERFACE_DIR
|
||||||
|
|
||||||
# Remove the below three legacy files if they exist
|
# Remove the below three legacy files if they exist
|
||||||
rm -f "/etc/pihole/GitHubVersions"
|
rm -f "/etc/pihole/GitHubVersions"
|
||||||
|
@ -88,8 +88,8 @@ getFTLConfigValue(){
|
|||||||
#######################
|
#######################
|
||||||
setFTLConfigValue(){
|
setFTLConfigValue(){
|
||||||
pihole-FTL --config "${1}" "${2}" >/dev/null
|
pihole-FTL --config "${1}" "${2}" >/dev/null
|
||||||
if [[ $? -eq 5 ]]; then
|
if [ $? -eq 5 ]; then
|
||||||
echo -e " ${CROSS} ${1} set by environment variable. Please unset it to use this function"
|
printf " %s %s set by environment variable. Please unset it to use this function\n" "${CROSS}" "${1}"
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,10 @@
|
|||||||
cachedVersions="/etc/pihole/versions"
|
cachedVersions="/etc/pihole/versions"
|
||||||
|
|
||||||
if [ -f ${cachedVersions} ]; then
|
if [ -f ${cachedVersions} ]; then
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "$cachedVersions"
|
. "$cachedVersions"
|
||||||
else
|
else
|
||||||
echo "Could not find /etc/pihole/versions. Running update now."
|
echo "Could not find /etc/pihole/versions. Running update now."
|
||||||
pihole updatechecker
|
pihole updatechecker
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "$cachedVersions"
|
. "$cachedVersions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# Source utils.sh for getFTLConfigValue()
|
# Source utils.sh for getFTLConfigValue()
|
||||||
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
||||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "${utilsfile}"
|
. "${utilsfile}"
|
||||||
|
|
||||||
# Get file paths
|
# Get file paths
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# Source utils.sh for getFTLConfigValue()
|
# Source utils.sh for getFTLConfigValue()
|
||||||
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
||||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "${utilsfile}"
|
. "${utilsfile}"
|
||||||
|
|
||||||
# Get file paths
|
# Get file paths
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
# Source utils.sh for getFTLConfigValue(), getFTLPID()
|
# Source utils.sh for getFTLConfigValue(), getFTLPID()
|
||||||
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "${utilsfile}"
|
. "${utilsfile}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) Pi-hole (https://pi-hole.net)
|
# (c) Pi-hole (https://pi-hole.net)
|
||||||
@ -1752,7 +1751,8 @@ checkSelinux() {
|
|||||||
|
|
||||||
check_download_exists() {
|
check_download_exists() {
|
||||||
# Check if the download exists and we can reach the server
|
# Check if the download exists and we can reach the server
|
||||||
local status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
|
local status
|
||||||
|
status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
|
||||||
|
|
||||||
# Check the status code
|
# Check the status code
|
||||||
if grep -q "200" <<<"$status"; then
|
if grep -q "200" <<<"$status"; then
|
||||||
@ -2069,13 +2069,13 @@ 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!
|
||||||
# shellcheck disable=SC1090
|
|
||||||
if ! check_download_exists "$path"; then
|
if ! check_download_exists "$path"; then
|
||||||
if [ $? -eq 1 ]; then
|
local status
|
||||||
|
status=$?
|
||||||
|
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_LIGHT_GREEN}" "${COL_NC}"
|
||||||
return 2
|
elif [ "${status}" -eq 2 ]; then
|
||||||
elif [ $? -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
|
||||||
else
|
else
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
source "/opt/pihole/COL_TABLE"
|
source "/opt/pihole/COL_TABLE"
|
||||||
source "/opt/pihole/utils.sh"
|
source "/opt/pihole/utils.sh"
|
||||||
|
|
||||||
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||||
|
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_WHITE}Pi-hole${COL_NC}? [y/N] " answer
|
||||||
@ -39,6 +40,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
SKIP_INSTALL="true"
|
SKIP_INSTALL="true"
|
||||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC1090
|
|
||||||
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||||
@ -16,11 +15,9 @@ export LC_ALL=C
|
|||||||
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||||
# Source utils.sh for GetFTLConfigValue
|
# Source utils.sh for GetFTLConfigValue
|
||||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "${utilsfile}"
|
. "${utilsfile}"
|
||||||
|
|
||||||
coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "${coltable}"
|
. "${coltable}"
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
. "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
||||||
@ -306,7 +303,7 @@ migrate_to_database() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if gravity database needs to be updated
|
# Check if gravity database needs to be updated
|
||||||
upgrade_gravityDB "${gravityDBfile}" "${piholeDir}"
|
upgrade_gravityDB "${gravityDBfile}"
|
||||||
|
|
||||||
# Migrate list files to new database
|
# Migrate list files to new database
|
||||||
if [ -e "${adListFile}" ]; then
|
if [ -e "${adListFile}" ]; then
|
||||||
@ -334,7 +331,7 @@ migrate_to_database() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if gravity database needs to be updated
|
# Check if gravity database needs to be updated
|
||||||
upgrade_gravityDB "${gravityDBfile}" "${piholeDir}"
|
upgrade_gravityDB "${gravityDBfile}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if DNS resolution is available before proceeding
|
# Determine if DNS resolution is available before proceeding
|
||||||
@ -1100,7 +1097,7 @@ for var in "$@"; do
|
|||||||
"-t" | "--timeit") timed=true ;;
|
"-t" | "--timeit") timed=true ;;
|
||||||
"-r" | "--repair") repairSelector "$3" ;;
|
"-r" | "--repair") repairSelector "$3" ;;
|
||||||
"-u" | "--upgrade")
|
"-u" | "--upgrade")
|
||||||
upgrade_gravityDB "${gravityDBfile}" "${piholeDir}"
|
upgrade_gravityDB "${gravityDBfile}"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"-h" | "--help") helpFunc ;;
|
"-h" | "--help") helpFunc ;;
|
||||||
|
14
pihole
14
pihole
@ -247,12 +247,14 @@ Time:
|
|||||||
data=$(PostFTLData "dns/blocking" "{ \"blocking\": ${1}, \"timer\": ${tt} }")
|
data=$(PostFTLData "dns/blocking" "{ \"blocking\": ${1}, \"timer\": ${tt} }")
|
||||||
|
|
||||||
# Check the response
|
# Check the response
|
||||||
local extra=" forever"
|
local extra timer
|
||||||
local timer="$(echo "${data}"| jq --raw-output '.timer' )"
|
extra=" forever"
|
||||||
|
timer="$(echo "${data}"| jq --raw-output '.timer' )"
|
||||||
if [[ "${timer}" != "null" ]]; then
|
if [[ "${timer}" != "null" ]]; then
|
||||||
extra=" for ${timer}s"
|
extra=" for ${timer}s"
|
||||||
fi
|
fi
|
||||||
local str="Pi-hole $(echo "${data}" | jq --raw-output '.blocking')${extra}"
|
local str
|
||||||
|
str="Pi-hole $(echo "${data}" | jq --raw-output '.blocking')${extra}"
|
||||||
|
|
||||||
# Logout from the API
|
# Logout from the API
|
||||||
LogoutAPI
|
LogoutAPI
|
||||||
@ -375,14 +377,16 @@ statusFunc() {
|
|||||||
|
|
||||||
tailFunc() {
|
tailFunc() {
|
||||||
# Warn user if Pi-hole's logging is disabled
|
# Warn user if Pi-hole's logging is disabled
|
||||||
local logging_enabled=$(getFTLConfigValue dns.queryLogging)
|
local logging_enabled
|
||||||
|
logging_enabled=$(getFTLConfigValue dns.queryLogging)
|
||||||
if [[ "${logging_enabled}" != "true" ]]; then
|
if [[ "${logging_enabled}" != "true" ]]; then
|
||||||
echo " ${CROSS} Warning: Query logging is disabled"
|
echo " ${CROSS} Warning: Query logging is disabled"
|
||||||
fi
|
fi
|
||||||
echo -e " ${INFO} Press Ctrl-C to exit"
|
echo -e " ${INFO} Press Ctrl-C to exit"
|
||||||
|
|
||||||
# Get logfile path
|
# Get logfile path
|
||||||
readonly LOGFILE=$(getFTLConfigValue files.log.dnsmasq)
|
readonly LOGFILE
|
||||||
|
LOGFILE=$(getFTLConfigValue files.log.dnsmasq)
|
||||||
|
|
||||||
# Strip date from each line
|
# Strip date from each line
|
||||||
# Color blocklist/denylist/wildcard entries as red
|
# Color blocklist/denylist/wildcard entries as red
|
||||||
|
Loading…
x
Reference in New Issue
Block a user