From 3fce2cc3ad710781029453da458d60ae6d45b9fe Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:18:56 +0900 Subject: [PATCH] fix: return codes --- dzgui.sh | 2 +- helpers/funcs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dzgui.sh b/dzgui.sh index a92e175..07c06f8 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -581,7 +581,7 @@ fetch_helpers_by_sum(){ ["ui.py"]="be3da1e542d14105f4358dd38901e25a" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="2a27ab36d5f8071fe53bf8dfd3b8d88d" + ["funcs"]="10c7d9cb9fbb792626ec9e7a4a788ba5" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 3681c01..82ab6ce 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -843,7 +843,6 @@ test_connection(){ remote_host=cb res=$(get_response_code "${hr["codeberg.org"]}") if [[ $res -ne 200 ]]; then - printf "Failed to fetch new version. Rolling back" return 1 fi fi @@ -857,6 +856,12 @@ test_connection(){ } download_new_version(){ test_connection + rc=$? + if [[ $rc -eq 1 ]]; then + printf "Remote resource unavailable. Aborting" + logger WARN "Remote resource unavailable" + return 1 + fi local version_url="$(format_version_url)" mv "$src_path" "$src_path.old" curl -Ls "$version_url" > "$src_path" @@ -896,6 +901,7 @@ toggle(){ fi update_config download_new_version + [[ $? -eq 1 ]] && return 1 return 255 ;; Toggle[[:space:]]mod[[:space:]]install[[:space:]]mode)