Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Warner <me@adamwarner.co.uk>2022-08-23 21:10:12 +0300
committerAdam Warner <me@adamwarner.co.uk>2022-08-23 21:10:12 +0300
commita4b899c2566115d3e1faad2158a171c116dfb4f4 (patch)
treec1bc8f7a87dcacdcb432151572cf1f19eb2113c9
parent5421aad03e1aa372199dd64ae8cb25dc5a9a23a6 (diff)
Review suggestions (and shellcheck complaints)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
-rwxr-xr-xadvanced/Scripts/updatecheck.sh30
-rwxr-xr-xadvanced/Scripts/version.sh4
2 files changed, 10 insertions, 24 deletions
diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh
index 35986676..0c9f385e 100755
--- a/advanced/Scripts/updatecheck.sh
+++ b/advanced/Scripts/updatecheck.sh
@@ -41,33 +41,19 @@ function get_local_version() {
# shellcheck disable=SC1091
. /etc/pihole/setupVars.conf
-utilsfile="/opt/pihole/utils.sh"
-source "${utilsfile}"
+# Source the utils file
+# shellcheck disable=SC1091
+. /opt/pihole/utils.sh
# Remove the below three legacy files if they exist
-GITHUB_VERSION_FILE="/etc/pihole/GitHubVersions"
-LOCAL_BRANCH_FILE="/etc/pihole/localbranches"
-LOCAL_VERSION_FILE="/etc/pihole/localversions"
-
-if [ -f "${GITHUB_VERSION_FILE}" ]; then
- rm "${GITHUB_VERSION_FILE}"
-fi
-
-if [ -f "${LOCAL_BRANCH_FILE}" ]; then
- rm "${LOCAL_BRANCH_FILE}"
-fi
-
-if [ -f "${LOCAL_VERSION_FILE}" ]; then
- rm "${LOCAL_VERSION_FILE}"
-fi
+rm -f "/etc/pihole/GitHubVersions"
+rm -f "/etc/pihole/localbranches"
+rm -f "/etc/pihole/localversions"
# Create new versions file if it does not exist
VERSION_FILE="/etc/pihole/versions"
-
-if [ ! -f "${VERSION_FILE}" ]; then
- touch "${VERSION_FILE}"
- chmod 644 "${VERSION_FILE}"
-fi
+touch "${VERSION_FILE}"
+chmod 644 "${VERSION_FILE}"
if [[ "$2" == "remote" ]]; then
diff --git a/advanced/Scripts/version.sh b/advanced/Scripts/version.sh
index 0bda197e..7f44d35e 100755
--- a/advanced/Scripts/version.sh
+++ b/advanced/Scripts/version.sh
@@ -89,13 +89,13 @@ getRemoteVersion(){
local daemon="${1}"
local version
local cachedVersions
- local arrCache
cachedVersions="/etc/pihole/versions"
#If the above file exists, then we can read from that. Prevents overuse of GitHub API
if [[ -f "$cachedVersions" ]]; then
- source "$cachedVersions"
+ # shellcheck disable=SC1090
+ . "$cachedVersions"
case $daemon in
"pi-hole" ) echo "${GITHUB_CORE_VERSION}";;