From e2942dd6264fe2a9eed8a94fd0f5fd0aff1f1a93 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 20:41:31 -0600 Subject: [PATCH] update update function --- functions/update_apps.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4ec0713a..b87e8a18 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -137,27 +137,31 @@ count=0 while true do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') - if [[ $count -gt 2 ]]; then - return 1 - elif [[ $update_avail == "true" ]]; then + # if [[ $count -gt 2 ]]; then + # return 1 + if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then # sleep 6 # ((count++)) # continue before_loop=$(head -n 1 temp.txt) current_loop=0 - until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - sleep 1 - if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then + if [[ $current_loop -gt 3 ]]; then + return 1 #App failed to update, return error code to update_apps func + elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. before_loop=$(head -n 1 temp.txt) ((current_loop++)) fi + sleep 1 done fi break elif [[ $update_avail == "false" ]]; then break + else + sleep 3 fi done }