From 2bc4ba3d6226a19fc5d5346828b9b72a873714a2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 17:05:16 -0600 Subject: [PATCH] use regex rather than 2 variables to check update --- functions/update_apps.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 282e5c03..61d670a6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -132,13 +132,12 @@ update_app(){ current_loop=0 while true do - app_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') - cont_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}') - if [[ $app_update_avail == "true" || $cont_update_avail == "true" ]]; then + update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}') + if [[ $update_avail =~ "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then before_loop=$(head -n 1 all_app_status) current_loop=0 - until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$app_update_avail" || "$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}')" != "$cont_update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do if [[ $current_loop -gt 2 ]]; then cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code @@ -150,7 +149,7 @@ do done fi break - elif [[ $app_update_avail == "false" && $cont_update_avail == "false" ]]; then + elif [[ ! $update_avail =~ "true" ]]; then break else sleep 3