Browse Source

Function checks

Bob Mottram 8 years ago
parent
commit
9783a402cc
1 changed files with 31 additions and 0 deletions
  1. 31
    0
      src/freedombone-utils-selector

+ 31
- 0
src/freedombone-utils-selector View File

106
 # returns a list of available system variants
106
 # returns a list of available system variants
107
 # based upon the variants string in each app script
107
 # based upon the variants string in each app script
108
 function available_system_variants {
108
 function available_system_variants {
109
+    function_check item_in_array
110
+
109
     FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
111
     FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
110
 
112
 
111
     new_available_variants_list=()
113
     new_available_variants_list=()
127
 function is_valid_variant {
129
 function is_valid_variant {
128
     sys_type="$1"
130
     sys_type="$1"
129
     available_variants_list=()
131
     available_variants_list=()
132
+
133
+    function_check available_system_variants
130
     available_system_variants
134
     available_system_variants
131
 
135
 
132
     for variant_str in "${available_variants_list[@]}"
136
     for variant_str in "${available_variants_list[@]}"
140
 
144
 
141
 function show_available_variants {
145
 function show_available_variants {
142
     available_variants_list=()
146
     available_variants_list=()
147
+
148
+    function_check available_system_variants
143
     available_system_variants
149
     available_system_variants
144
 
150
 
145
     for variant_str in "${available_variants_list[@]}"
151
     for variant_str in "${available_variants_list[@]}"
250
 function detect_apps {
256
 function detect_apps {
251
     FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
257
     FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
252
 
258
 
259
+    function_check item_in_array
260
+
253
     APPS_AVAILABLE=()
261
     APPS_AVAILABLE=()
254
     APPS_CHOSEN=()
262
     APPS_CHOSEN=()
255
 
263
 
281
     APPS_INSTALLED=()
289
     APPS_INSTALLED=()
282
     APPS_INSTALLED_NAMES=()
290
     APPS_INSTALLED_NAMES=()
283
 
291
 
292
+    function_check app_variants
284
     function_check app_is_installed
293
     function_check app_is_installed
294
+    function_check item_in_array
285
 
295
 
286
     # for all the app scripts
296
     # for all the app scripts
287
     for filename in $FILES
297
     for filename in $FILES
309
 function choose_apps_for_variant {
319
 function choose_apps_for_variant {
310
     variant_name="$1"
320
     variant_name="$1"
311
 
321
 
322
+    function_check item_in_array
323
+    function_check app_variants
324
+    function_check app_is_removed
325
+
312
     if [ ${#variant_name} -eq 0 ]; then
326
     if [ ${#variant_name} -eq 0 ]; then
313
         echo $"No variant name for choosing apps"
327
         echo $"No variant name for choosing apps"
314
         exit 237567
328
         exit 237567
370
         if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
384
         if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
371
             if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
385
             if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
372
                 echo $"Removing application: ${a}"
386
                 echo $"Removing application: ${a}"
387
+
388
+                function_check app_load_variables
373
                 app_load_variables ${a}
389
                 app_load_variables ${a}
390
+
391
+                function_check remove_app
374
                 remove_app ${a}
392
                 remove_app ${a}
393
+
394
+                function_check remove_${a}
375
                 remove_${a}
395
                 remove_${a}
396
+
376
                 echo $"${a} was removed"
397
                 echo $"${a} was removed"
377
             fi
398
             fi
378
         fi
399
         fi
417
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
438
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
418
                 if [ ${is_interactive} ]; then
439
                 if [ ${is_interactive} ]; then
419
                     # clears any removal indicator
440
                     # clears any removal indicator
441
+                    function_check reinstall_app
420
                     reinstall_app ${a}
442
                     reinstall_app ${a}
421
 
443
 
444
+                    function_check app_load_variables
422
                     app_load_variables ${a}
445
                     app_load_variables ${a}
423
 
446
 
424
                     if [[ $(app_is_installed ${a}) == "1" ]]; then
447
                     if [[ $(app_is_installed ${a}) == "1" ]]; then
430
                         APP_INSTALLED=
453
                         APP_INSTALLED=
431
                         install_${a}
454
                         install_${a}
432
                         if [ $APP_INSTALLED ]; then
455
                         if [ $APP_INSTALLED ]; then
456
+                            function_check app_save_variables
433
                             app_save_variables ${a}
457
                             app_save_variables ${a}
458
+
459
+                            function_check install_completed
434
                             install_completed ${a}
460
                             install_completed ${a}
435
                             echo $"${a} was installed from interactive"
461
                             echo $"${a} was installed from interactive"
436
                         else
462
                         else
440
                 else
466
                 else
441
                     # check if the app was removed
467
                     # check if the app was removed
442
                     if [[ $(app_is_removed ${a}) == "0" ]]; then
468
                     if [[ $(app_is_removed ${a}) == "0" ]]; then
469
+                        function_check app_load_variables
443
                         app_load_variables ${a}
470
                         app_load_variables ${a}
444
                         if [[ $(app_is_installed ${a}) == "1" ]]; then
471
                         if [[ $(app_is_installed ${a}) == "1" ]]; then
445
                             echo $"Upgrading application: ${a}"
472
                             echo $"Upgrading application: ${a}"
450
                             APP_INSTALLED=
477
                             APP_INSTALLED=
451
                             install_${a}
478
                             install_${a}
452
                             if [ $APP_INSTALLED ]; then
479
                             if [ $APP_INSTALLED ]; then
480
+                                function_check app_save_variables
453
                                 app_save_variables ${a}
481
                                 app_save_variables ${a}
482
+
483
+                                function_check install_completed
454
                                 install_completed ${a}
484
                                 install_completed ${a}
455
                                 echo $"${a} was installed"
485
                                 echo $"${a} was installed"
456
                             else
486
                             else
466
         app_index=$[app_index+1]
496
         app_index=$[app_index+1]
467
     done
497
     done
468
 
498
 
499
+    function_check update_installed_apps_list
469
     update_installed_apps_list
500
     update_installed_apps_list
470
 }
501
 }
471
 
502