mirror of
https://github.com/aclist/dztui.git
synced 2024-12-29 13:52:03 +01:00
fix: return codes
This commit is contained in:
parent
f57973c145
commit
de5b530968
2 changed files with 12 additions and 10 deletions
9
dzgui.sh
9
dzgui.sh
|
@ -529,17 +529,20 @@ fetch_helpers_by_sum(){
|
||||||
["ui.py"]="8c430f1465995cbd98f4ad8e2580a79d"
|
["ui.py"]="8c430f1465995cbd98f4ad8e2580a79d"
|
||||||
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
|
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="b04a0e34141e4e11da0a061802a822e3"
|
["funcs"]="3aae486ae5097fa9b7349df1dfd25734"
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
local repo="dztui"
|
local repo="dztui"
|
||||||
local branch="$branch"
|
local branch="$branch"
|
||||||
local url="https://raw.githubusercontent.com/$author/$repo/$branch/helpers/$file"
|
local file
|
||||||
|
local sum
|
||||||
|
local full_path
|
||||||
|
|
||||||
for i in "${!sums[@]}"; do
|
for i in "${!sums[@]}"; do
|
||||||
file="$i"
|
file="$i"
|
||||||
sum="${sums[$i]}"
|
sum="${sums[$i]}"
|
||||||
full_path="$helpers_path/$file"
|
full_path="$helpers_path/$file"
|
||||||
|
url="https://raw.githubusercontent.com/$author/$repo/$branch/helpers/$file"
|
||||||
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
||||||
logger INFO "'$file' is current"
|
logger INFO "'$file' is current"
|
||||||
else
|
else
|
||||||
|
@ -548,9 +551,9 @@ fetch_helpers_by_sum(){
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
raise_error_and_quit "Failed to fetch the file '$file'. Possible timeout?"
|
raise_error_and_quit "Failed to fetch the file '$file'. Possible timeout?"
|
||||||
fi
|
fi
|
||||||
|
logger INFO "Updated '$full_path' to sum '$sum'"
|
||||||
fi
|
fi
|
||||||
[[ $file == "funcs" ]] && chmod +x "$full_path"
|
[[ $file == "funcs" ]] && chmod +x "$full_path"
|
||||||
logger INFO "Updated '$full_path' to sum '$sum'"
|
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -739,7 +739,8 @@ toggle(){
|
||||||
branch="stable"
|
branch="stable"
|
||||||
fi
|
fi
|
||||||
update_config
|
update_config
|
||||||
download_new_version
|
return 255
|
||||||
|
# download_new_version
|
||||||
;;
|
;;
|
||||||
Toggle[[:space:]]mod[[:space:]]install[[:space:]]mode)
|
Toggle[[:space:]]mod[[:space:]]install[[:space:]]mode)
|
||||||
if [[ -z $auto_install ]]; then
|
if [[ -z $auto_install ]]; then
|
||||||
|
@ -764,6 +765,7 @@ toggle(){
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
update_config
|
update_config
|
||||||
|
return 90
|
||||||
|
|
||||||
}
|
}
|
||||||
add_to_favs(){
|
add_to_favs(){
|
||||||
|
@ -771,6 +773,7 @@ add_to_favs(){
|
||||||
ip_list+=("$record")
|
ip_list+=("$record")
|
||||||
update_config
|
update_config
|
||||||
logger INFO "Added the record $record to saved servers"
|
logger INFO "Added the record $record to saved servers"
|
||||||
|
return 90
|
||||||
}
|
}
|
||||||
remove_from_history(){
|
remove_from_history(){
|
||||||
shift
|
shift
|
||||||
|
@ -799,6 +802,7 @@ remove_from_favs(){
|
||||||
local cache="$(< "$_cache_my_servers")"
|
local cache="$(< "$_cache_my_servers")"
|
||||||
<<< "$cache" grep -v -P "$r$" > $_cache_my_servers
|
<<< "$cache" grep -v -P "$r$" > $_cache_my_servers
|
||||||
logger INFO "Removed the record $record from saved servers"
|
logger INFO "Removed the record $record from saved servers"
|
||||||
|
return 90
|
||||||
}
|
}
|
||||||
update_favs_from_table(){
|
update_favs_from_table(){
|
||||||
local context="$1"
|
local context="$1"
|
||||||
|
@ -815,12 +819,6 @@ update_config(){
|
||||||
[[ -z $branch ]] && branch="stable"
|
[[ -z $branch ]] && branch="stable"
|
||||||
mv $config_file ${config_file}.old
|
mv $config_file ${config_file}.old
|
||||||
write_config > $config_file
|
write_config > $config_file
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
printf "Updated config file"
|
|
||||||
return 90
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
logger INFO "Updated config file at '$config_file'"
|
logger INFO "Updated config file at '$config_file'"
|
||||||
}
|
}
|
||||||
validate_ip(){
|
validate_ip(){
|
||||||
|
@ -874,6 +872,7 @@ update_config_val(){
|
||||||
declare -n nr=$key
|
declare -n nr=$key
|
||||||
nr="$value"
|
nr="$value"
|
||||||
update_config
|
update_config
|
||||||
|
return 90
|
||||||
}
|
}
|
||||||
show_log(){
|
show_log(){
|
||||||
< "$debug_log" sed 's/Keyword␞/Keyword/'
|
< "$debug_log" sed 's/Keyword␞/Keyword/'
|
||||||
|
|
Loading…
Reference in a new issue