Review suggestions (and shellcheck complaints)

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2022-08-23 19:10:12 +01:00
parent 5421aad03e
commit a4b899c256
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173
2 changed files with 10 additions and 24 deletions

View File

@ -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

View File

@ -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}";;