@@ -8,33 +8,28 @@ for dir in "$APPS_DIR"/*/; do
88 folder_name=$( basename " $dir " )
99 for install_file in " $dir " /install* ; do
1010 [[ -f " $install_file " ]] || continue
11- old_version=$( grep -E ' ^VERSION=' " $install_file " | cut -d' =' -f2 | sed ' s/"//g' )
12- if [[ ! -z " $old_version " ]]; then
13- workflow_script=" $WORKFLOWS_DIR /$folder_name .sh"
14- workflow_script=$( echo " $workflow_script " | tr ' ' ' \ ' )
11+ old_version=$( cat " $install_file " | grep ' VERSION=' | cut -d' =' -f2 | head -n1 | sed ' s/"//g' )
12+ workflow_script=" $WORKFLOWS_DIR /$folder_name .sh"
13+ workflow_script=$( echo " $workflow_script " | tr ' ' ' \ ' )
1514
16- if [ -e " $workflow_script " ]; then
17- new_version=$( bash " $workflow_script " 2> /dev/null || echo " $old_version " )
18- else
19- new_version=" $old_version "
20- fi
15+ if [ -e " $workflow_script " ]; then
16+ new_version=$( bash " $workflow_script " || echo " $old_version " )
17+ else
18+ new_version=" $old_version "
19+ fi
2120
22- if [[ " $new_version " == " $old_version " ]]; then
23- ./api info " No update required for $folder_name "
24- else
25- ./api info " $folder_name - $( basename " $install_file " ) : old version=$old_version , new version=$new_version "
26- if [ ! -e updates_list.txt ]; then
27- echo -n " $folder_name " >> updates_list.txt
28- elif ! grep " $folder_name " updates_list.txt & > /dev/null; then
29- echo -n " , $folder_name " >> updates_list.txt
30- fi
31- sed -i " s/VERSION=${old_version} /VERSION=${new_version} /" " $install_file "
32- sed -i " s/VERSION=\" $old_version \" /VERSION=\" $new_version \" /" " $install_file "
21+ if [[ " $new_version " == " $old_version " ]]; then
22+ ./api info " $folder_name - $( basename " $install_file " ) : old version=$old_version , new version=$new_version "
23+ ./api info " No update required for $folder_name "
24+ else
25+ ./api info " $folder_name - $( basename " $install_file " ) : old version=$old_version , new version=$new_version "
26+ if [ ! -e updates_list.txt ]; then
27+ echo -n " $folder_name " >> updates_list.txt
28+ elif ! grep " $folder_name " updates_list.txt & > /dev/null; then
29+ echo -n " , $folder_name " >> updates_list.txt
3330 fi
31+ sed -i " s/VERSION=${old_version} /VERSION=${new_version} /" " $install_file "
32+ sed -i " s/VERSION=\" $old_version \" /VERSION=\" $new_version \" /" " $install_file "
3433 fi
3534 done
36- done
37-
38- curl -s https://api.github.com/repos/microsoft/vscode/releases/latest
39- curl -s https://api.github.com/repos/betterscratch/desktop/releases/latest
40- curl -s https://api.github.com/repos/modrinth/code/releases/latest
35+ done
0 commit comments