Fix more shellcheck warnings
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
# shellcheck disable=SC3043 #https://github.com/koalaman/shellcheck/wiki/SC3043#exceptions
|
||||
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
|
||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source="./utils.sh"
|
||||
source "${utilsfile}"
|
||||
|
||||
readonly apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
|
||||
# shellcheck source="./api.sh"
|
||||
source "${apifile}"
|
||||
|
||||
# Determine database location
|
||||
@@ -38,6 +40,7 @@ typeId=""
|
||||
comment=""
|
||||
|
||||
colfile="/opt/pihole/COL_TABLE"
|
||||
# shellcheck source="./COL_TABLE"
|
||||
source ${colfile}
|
||||
|
||||
helpFunc() {
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
|
||||
coltable="/opt/pihole/COL_TABLE"
|
||||
if [[ -f ${coltable} ]]; then
|
||||
# shellcheck source="./COL_TABLE"
|
||||
source ${coltable}
|
||||
fi
|
||||
|
||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source="./utils.sh"
|
||||
source "${utilsfile}"
|
||||
|
||||
# Determine database location
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||
# shellcheck disable=SC2034
|
||||
SKIP_INSTALL="true"
|
||||
# shellcheck source="../../automated install/basic-install.sh"
|
||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||
|
||||
# webInterfaceGitUrl set in basic-install.sh
|
||||
@@ -218,7 +219,7 @@ checkout() {
|
||||
if [ $status -eq 1 ]; then
|
||||
# Binary for requested branch is not available, may still be
|
||||
# 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"
|
||||
exit 1
|
||||
elif [ $status -eq 2 ]; then
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
|
||||
# -e option instructs bash to immediately exit if any command [1] has a non-zero exit status
|
||||
# -u a reference to any variable you haven't previously defined
|
||||
@@ -27,6 +26,7 @@ PIHOLE_COLTABLE_FILE="${PIHOLE_SCRIPTS_DIRECTORY}/COL_TABLE"
|
||||
|
||||
# These provide the colors we need for making the log more readable
|
||||
if [[ -f ${PIHOLE_COLTABLE_FILE} ]]; then
|
||||
# shellcheck source=./COL_TABLE
|
||||
source ${PIHOLE_COLTABLE_FILE}
|
||||
else
|
||||
COL_NC='\e[0m' # No Color
|
||||
@@ -41,7 +41,7 @@ else
|
||||
#OVER="\r\033[K"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/pihole/versions
|
||||
|
||||
# Read the value of an FTL config key. The value is printed to stdout.
|
||||
@@ -213,7 +213,7 @@ compare_local_version_to_git_version() {
|
||||
local local_status
|
||||
local_status=$(git status -s)
|
||||
# echo this information out to the user in a nice format
|
||||
if [ ${local_version} ]; then
|
||||
if [ "${local_version}" ]; then
|
||||
log_write "${TICK} Version: ${local_version}"
|
||||
elif [ -n "${DOCKER_VERSION}" ]; then
|
||||
log_write "${TICK} Version: Pi-hole Docker Container ${COL_BOLD}${DOCKER_VERSION}${COL_NC}"
|
||||
@@ -488,7 +488,9 @@ run_and_print_command() {
|
||||
local output
|
||||
output=$(${cmd} 2>&1)
|
||||
# If the command was successful,
|
||||
if [[ $? -eq 0 ]]; then
|
||||
local return_code
|
||||
return_code=$?
|
||||
if [[ "${return_code}" -eq 0 ]]; then
|
||||
# show the output
|
||||
log_write "${output}"
|
||||
else
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
colfile="/opt/pihole/COL_TABLE"
|
||||
# shellcheck source="./COL_TABLE"
|
||||
source ${colfile}
|
||||
|
||||
readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source="./utils.sh"
|
||||
source "${utilsfile}"
|
||||
|
||||
# In case we're running at the same time as a system logrotate, use a
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
|
||||
# Ignore warning about `local` being undefinded in POSIX
|
||||
# shellcheck disable=SC3043
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC3043#exceptions
|
||||
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2023 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
@@ -22,6 +17,7 @@ domain=""
|
||||
|
||||
# Source color table
|
||||
colfile="/opt/pihole/COL_TABLE"
|
||||
# shellcheck source="./COL_TABLE"
|
||||
. "${colfile}"
|
||||
|
||||
# Source api functions
|
||||
|
||||
@@ -21,10 +21,11 @@ SKIP_INSTALL=true
|
||||
# when --check-only is passed to this script, it will not perform the actual update
|
||||
CHECK_ONLY=false
|
||||
|
||||
# shellcheck source="../../automated install/basic-install.sh"
|
||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source=./COL_TABLE
|
||||
source "/opt/pihole/COL_TABLE"
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source="./utils.sh"
|
||||
source "${PI_HOLE_INSTALL_DIR}/utils.sh"
|
||||
|
||||
# is_repo() sourced from basic-install.sh
|
||||
|
||||
@@ -39,7 +39,7 @@ function get_remote_hash() {
|
||||
}
|
||||
|
||||
# Source the utils file for addOrEditKeyValPair()
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source="./utils.sh"
|
||||
. /opt/pihole/utils.sh
|
||||
|
||||
ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
# shellcheck disable=SC3043 #https://github.com/koalaman/shellcheck/wiki/SC3043#exceptions
|
||||
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
|
||||
@@ -8,18 +8,16 @@
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
# Ignore warning about `local` being undefinded in POSIX
|
||||
# shellcheck disable=SC3043
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC3043#exceptions
|
||||
|
||||
# Source the versions file populated by updatechecker.sh
|
||||
cachedVersions="/etc/pihole/versions"
|
||||
|
||||
if [ -f ${cachedVersions} ]; then
|
||||
# shellcheck source=/dev/null
|
||||
. "$cachedVersions"
|
||||
else
|
||||
echo "Could not find /etc/pihole/versions. Running update now."
|
||||
pihole updatechecker
|
||||
# shellcheck source=/dev/null
|
||||
. "$cachedVersions"
|
||||
fi
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Source utils.sh for getFTLConfigValue()
|
||||
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source="../Scripts/utils.sh"
|
||||
. "${utilsfile}"
|
||||
|
||||
# Get file paths
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Source utils.sh for getFTLConfigValue()
|
||||
PI_HOLE_SCRIPT_DIR='/opt/pihole'
|
||||
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source="../Scripts/utils.sh"
|
||||
. "${utilsfile}"
|
||||
|
||||
# Get file paths
|
||||
|
||||
Reference in New Issue
Block a user