Review suggestions (and shellcheck complaints)

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
pull/4875/head
Adam Warner 2 years ago
parent 5421aad03e
commit a4b899c256
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173

@ -41,33 +41,19 @@ function get_local_version() {
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. /etc/pihole/setupVars.conf . /etc/pihole/setupVars.conf
utilsfile="/opt/pihole/utils.sh" # Source the utils file
source "${utilsfile}" # shellcheck disable=SC1091
. /opt/pihole/utils.sh
# Remove the below three legacy files if they exist # Remove the below three legacy files if they exist
GITHUB_VERSION_FILE="/etc/pihole/GitHubVersions" rm -f "/etc/pihole/GitHubVersions"
LOCAL_BRANCH_FILE="/etc/pihole/localbranches" rm -f "/etc/pihole/localbranches"
LOCAL_VERSION_FILE="/etc/pihole/localversions" rm -f "/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
# Create new versions file if it does not exist # Create new versions file if it does not exist
VERSION_FILE="/etc/pihole/versions" VERSION_FILE="/etc/pihole/versions"
touch "${VERSION_FILE}"
if [ ! -f "${VERSION_FILE}" ]; then chmod 644 "${VERSION_FILE}"
touch "${VERSION_FILE}"
chmod 644 "${VERSION_FILE}"
fi
if [[ "$2" == "remote" ]]; then if [[ "$2" == "remote" ]]; then

@ -89,13 +89,13 @@ getRemoteVersion(){
local daemon="${1}" local daemon="${1}"
local version local version
local cachedVersions local cachedVersions
local arrCache
cachedVersions="/etc/pihole/versions" cachedVersions="/etc/pihole/versions"
#If the above file exists, then we can read from that. Prevents overuse of GitHub API #If the above file exists, then we can read from that. Prevents overuse of GitHub API
if [[ -f "$cachedVersions" ]]; then if [[ -f "$cachedVersions" ]]; then
source "$cachedVersions" # shellcheck disable=SC1090
. "$cachedVersions"
case $daemon in case $daemon in
"pi-hole" ) echo "${GITHUB_CORE_VERSION}";; "pi-hole" ) echo "${GITHUB_CORE_VERSION}";;

Loading…
Cancel
Save