This commit is contained in:
Heavybullets8 2022-07-25 23:38:29 -06:00
parent 27b8d258cf
commit 51eacf44a2

View File

@ -11,14 +11,18 @@ echo "Asynchronous Updates: $update_limit"
it=0 it=0
while [[ $it -lt ${#array[@]} ]] while [[ $it -lt ${#array[@]} ]]
do do
jobs=$(jobs -p | wc -l) proc_count=${#processes[@]}
if [[ "$jobs" -ge "$update_limit" ]]; then for proc in "${processes[@]}"
do
kill -0 "$proc" || ((proc_count--))
done
#jobs=$(jobs -p | wc -l)
if [[ "$proc_count" -ge "$update_limit" ]]; then
sleep 1 sleep 1
else else
update_apps "${array[$it]}" & update_apps "${array[$it]}" &
processes+=($!) processes+=($!)
((it++)) ((it++))
echo "$processes"
fi fi
done done
@ -33,7 +37,7 @@ export -f commander
update_apps(){ update_apps(){
app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name.
printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && exit 0 #If application is on ignore list, skip printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip
old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version
new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version
old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version