1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

ShellCheck split local declaration and assignment.

This commit is contained in:
Dan Schaper 2016-11-02 11:01:50 -07:00
parent b8a5ed710e
commit bd68db51e0

View File

@ -40,9 +40,8 @@ make_repo() {
local remoteRepo="${2}" local remoteRepo="${2}"
local directory="${1}" local directory="${1}"
if ! (prep_dirs "${directory}" && git clone -q --depth 1 "${remoteRepo}" "${directory}" > /dev/null); then \ (prep_dirs "${directory}" && git clone -q --depth 1 "${remoteRepo}" "${directory}" > /dev/null)
return false return
fi
} }
update_repo() { update_repo() {
@ -63,7 +62,7 @@ getGitFiles() {
# Setup git repos for directory and repository passed # Setup git repos for directory and repository passed
# as arguments 1 and 2 # as arguments 1 and 2
local directory="${1}" local directory="${1}"
local remoteRepo="{$2}" local remoteRepo="${2}"
echo ":::" echo ":::"
echo "::: Checking for existing repository..." echo "::: Checking for existing repository..."
if is_repo "${directory}"; then if is_repo "${directory}"; then
@ -76,6 +75,10 @@ getGitFiles() {
} }
main() { main() {
local pihole_version_current
local pihole_version_latest
local web_version_current
local web_version_latest
if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${ADMIN_INTERFACE_DIR}" ; then #This is unlikely if ! is_repo "${PI_HOLE_FILES_DIR}" || ! is_repo "${ADMIN_INTERFACE_DIR}" ; then #This is unlikely
echo "::: Critical Error: One or more Pi-Hole repos are missing from system!" echo "::: Critical Error: One or more Pi-Hole repos are missing from system!"
@ -85,14 +88,14 @@ main() {
echo "::: Checking for updates..." echo "::: Checking for updates..."
# Checks Pi-hole version > pihole only > current local git repo version : returns string in format vX.X.X # Checks Pi-hole version > pihole only > current local git repo version : returns string in format vX.X.X
local pihole_version_current="$(/usr/local/bin/pihole -v -p -c)" pihole_version_current="$(/usr/local/bin/pihole -v -p -c)"
# Checks Pi-hole version > pihole only > remote upstream repo version : returns string in format vX.X.X # Checks Pi-hole version > pihole only > remote upstream repo version : returns string in format vX.X.X
local pihole_version_latest="$(/usr/local/bin/pihole -v -p -l)" pihole_version_latest="$(/usr/local/bin/pihole -v -p -l)"
# Checks Pi-hole version > admin only > current local git repo version : returns string in format vX.X.X # Checks Pi-hole version > admin only > current local git repo version : returns string in format vX.X.X
local web_version_current="$(/usr/local/bin/pihole -v -a -c)" web_version_current="$(/usr/local/bin/pihole -v -a -c)"
# Checks Pi-hole version > admin only > remote upstream repo version : returns string in format vX.X.X # Checks Pi-hole version > admin only > remote upstream repo version : returns string in format vX.X.X
local web_version_latest="$(/usr/local/bin/pihole -v -a -l)" web_version_latest="$(/usr/local/bin/pihole -v -a -l)"
# Logic # Logic
# If latest versions are blank - we've probably hit Github rate limit (stop running `pihole -up so often!): # If latest versions are blank - we've probably hit Github rate limit (stop running `pihole -up so often!):