From 3a35e589f2ead2aa85c146c17f7246401248b602 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 26 Jun 2025 00:40:37 +0200 Subject: [PATCH] installer: exit if FTL update check fails The return code of `FTLdetect()` is used in the installer to know whether FTL has been installed or not. The function however returns an error only, if the download of FTL fails, not if checking for a latest version/update of FTL fails. This way, installs and rapairs can continue without or with ourdated FTL until `pihole-FTL migrate v6`, which hangs endlessly, if it is a v5 FTL. This commit handles the return code in `FTLdetect()`, and lets it return true only if FTL download succeeded, or if the update check succeeded and FTL is up-to-date. Else, it could neither be repaired, nor installed, and the error message should give a hint what went wrong, hence exit. `FTLdetect()` is not called by any other script, hence this change has no surprising effect elsewhere. Additionally, a syntax error in the `FTLcheckUpdate()` function itself is fixed, which masks the `check_download_exists()` return code, hence always leads to error code 4, if the FTL branch is not `master`. Signed-off-by: MichaIng --- automated install/basic-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 279dc1d1..afb9dc50 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1940,8 +1940,8 @@ FTLcheckUpdate() { path="${ftlBranch}/${binary}" # Check whether or not the binary for this FTL branch actually exists. If not, then there is no update! + local status if ! check_download_exists "$path"; then - local status status=$? if [ "${status}" -eq 1 ]; then printf " %b Branch \"%s\" is not available.\\n" "${INFO}" "${ftlBranch}" @@ -2031,6 +2031,11 @@ FTLdetect() { if FTLcheckUpdate "${1}"; then FTLinstall "${1}" || return 1 + else + case $? in + 1) :;; # FTL is up-to-date + *) exit 1;; # 404 (2), other HTTP or curl error (3), unknown (4) + esac fi }