Fix return status capture of FTL check_download exists

Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
Christian König
2026-03-22 09:49:54 +01:00
parent bdeb05b941
commit 300cdb71b8
2 changed files with 9 additions and 7 deletions

View File

@@ -186,7 +186,10 @@ checkout() {
echo -e " ${INFO} Checking for ${COL_YELLOW}${binary}${COL_NC} binary on https://ftl.pi-hole.net"
if check_download_exists "$path"; then
local download_status
check_download_exists "$path"
download_status=$?
if [ $download_status -eq 0 ]; then
echo " ${TICK} Binary exists"
echo "${2}" > /etc/pihole/ftlbranch
chmod 644 /etc/pihole/ftlbranch
@@ -210,15 +213,13 @@ checkout() {
# Update local and remote versions via updatechecker
/opt/pihole/updatecheck.sh
else
local status
status=$?
if [ $status -eq 1 ]; then
if [ $download_status -eq 1 ]; then
# Binary for requested branch is not available, may still be
# int he process of being built or CI build job failed
printf " %b Binary for requested branch is not available, please try again later.\\n" "${CROSS}"
printf " If the issue persists, please contact Pi-hole Support and ask them to re-generate the binary.\\n"
exit 1
elif [ $status -eq 2 ]; then
elif [ $download_status -eq 2 ]; then
printf " %b Unable to download from ftl.pi-hole.net. Please check your Internet connection and try again later.\\n" "${CROSS}"
exit 1
else

View File

@@ -2042,8 +2042,9 @@ FTLcheckUpdate() {
# 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
status=$?
check_download_exists "${path}"
status=$?
if [ "${status}" -ne 0 ]; then
if [ "${status}" -eq 1 ]; then
printf " %b Branch \"%s\" is not available.\\n" "${INFO}" "${ftlBranch}"
printf " %b Use %bpihole checkout ftl [branchname]%b to switch to a valid branch.\\n" "${INFO}" "${COL_GREEN}" "${COL_NC}"