Browse Source

App install logic

Bob Mottram 9 years ago
parent
commit
56df73944e
1 changed files with 15 additions and 12 deletions
  1. 15
    12
      src/freedombone-utils-selector

+ 15
- 12
src/freedombone-utils-selector View File

283
 function install_apps {
283
 function install_apps {
284
     is_interactive=$1
284
     is_interactive=$1
285
 
285
 
286
-    app_index=0
287
-    for a in "${APPS_AVAILABLE[@]}"
288
-    do
289
-        if [[ $(app_is_removed ${a}) == "0" ]]; then
286
+    # interactive install configuration for each app
287
+    if [ ${is_interactive} ]; then
288
+        app_index=0
289
+        for a in "${APPS_AVAILABLE[@]}"
290
+        do
290
             if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
291
             if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
291
                 if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
292
                 if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
292
-                    if [ ${is_interactive} ]; then
293
-                        # interactively obtain settings for this app
294
-                        if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
295
-                            install_interactive_${a}
296
-                        fi
293
+                    # interactively obtain settings for this app
294
+                    if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
295
+                        install_interactive_${a}
297
                     fi
296
                     fi
298
                 fi
297
                 fi
299
             fi
298
             fi
300
-        fi
301
-        app_index=$[app_index+1]
302
-    done
299
+            app_index=$[app_index+1]
300
+        done
301
+    fi
303
 
302
 
303
+    # now install the apps
304
     app_index=0
304
     app_index=0
305
     for a in "${APPS_AVAILABLE[@]}"
305
     for a in "${APPS_AVAILABLE[@]}"
306
     do
306
     do
307
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
307
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
308
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
308
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
309
                 if [ ${is_interactive} ]; then
309
                 if [ ${is_interactive} ]; then
310
+                    # clears any removal indicator
310
                     reinstall_app ${a}
311
                     reinstall_app ${a}
312
+
311
                     echo $"Installing application from interactive: ${a}"
313
                     echo $"Installing application from interactive: ${a}"
312
                     install_${a}
314
                     install_${a}
313
                     echo $"${a} was installed from interactive"
315
                     echo $"${a} was installed from interactive"
314
                 else
316
                 else
317
+                    # check if the app was removed
315
                     if [[ $(app_is_removed ${a}) == "0" ]]; then
318
                     if [[ $(app_is_removed ${a}) == "0" ]]; then
316
                         echo $"Installing application: ${a}"
319
                         echo $"Installing application: ${a}"
317
                         install_${a}
320
                         install_${a}