Currently, if the FTL update check returns 404, hence the FTL branch does not seem to exist, an error message is printed, but the update continues, only the FTL update is skipped.
This can lead to setups with v5 FTL and v6 core/web, failing at config migration, where FTL is invoked with a v6-only command.
With this change, the update aborts immediately if the FTL branch is invalid, like it does in case of other FTL update check errors (other HTTP error codes than 404 or other curl errors). Hence it continues only if FTL is up-to-date already, or a new version from the given branch has been found.
Signed-off-by: MichaIng <micha@dietpi.com>
Determine address and interface of default route by preceeding
'via' and 'dev' fields in json output instead of plain text
field position.
Log if unable to determine default gateway
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In ./advanced/Scripts/update.sh line 39:
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In ./advanced/Scripts/updatecheck.sh line 45:
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
source ${colfile}
^--------^ SC1090 (warning): ShellCheck can't follow non-constant source. Use a directive to specify location.
In ./advanced/Scripts/piholeLogFlush.sh line 16:
source "${utilsfile}"
^------------^ SC1090 (warning): ShellCheck can't follow non-constant source. Use a directive to specify location.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
corebranches=($(get_available_branches "${PI_HOLE_FILES_DIR}"))
^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
In ./advanced/Scripts/piholeCheckout.sh line 139:
webbranches=($(get_available_branches "${webInterfaceDir}"))
^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
In ./advanced/Scripts/piholeCheckout.sh line 170:
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep "refs/heads" | cut -d'/' -f3- -) )
^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
In ./advanced/Scripts/piholeCheckout.sh line 218:
elif [ $? -eq 2 ]; then
^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
piholeDir="${2}"
^-------^ SC2034 (warning): piholeDir appears unused. Verify use (or export if used externally).
Turns out it is _actually_ unused, the full path of the gravity database is passed to the function, so we'll tidy this up rather than supressing.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>