Browse Source

Initially select all apps for install in interactive mode

Bob Mottram 8 years ago
parent
commit
ad39b2c78d
3 changed files with 33 additions and 23 deletions
  1. 32
    12
      src/freedombone-addremove
  2. 0
    10
      src/freedombone-utils-selector
  3. 1
    1
      src/freedombone-utils-setup

+ 32
- 12
src/freedombone-addremove View File

@@ -130,14 +130,33 @@ function remove_apps_selected {
130 130
 }
131 131
 
132 132
 function install_apps_selected {
133
+    select_all_apps=$1
133 134
     # which apps need to be installed?
134 135
     installs=""
135 136
     app_index=0
136 137
     n=0
137
-    for a in "${APPS_INSTALLED[@]}"
138
-    do
139
-        if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
140
-            if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
138
+
139
+    if [ ! $select_all_apps ]; then
140
+        for a in "${APPS_INSTALLED[@]}"
141
+        do
142
+            if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
143
+                if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
144
+                    if [ ${n} -gt 0 ]; then
145
+                        installs="$installs ${APPS_AVAILABLE[$app_index]}"
146
+                    else
147
+                        installs="${APPS_AVAILABLE[$app_index]}"
148
+                    fi
149
+                    n=$[n+1]
150
+                fi
151
+            fi
152
+            app_index=$[app_index+1]
153
+        done
154
+    fi
155
+
156
+    if [[ $select_all_apps == "add-all" ]]; then
157
+        for a in "${APPS_INSTALLED[@]}"
158
+        do
159
+            if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
141 160
                 if [ ${n} -gt 0 ]; then
142 161
                     installs="$installs ${APPS_AVAILABLE[$app_index]}"
143 162
                 else
@@ -145,9 +164,10 @@ function install_apps_selected {
145 164
                 fi
146 165
                 n=$[n+1]
147 166
             fi
148
-        fi
149
-        app_index=$[app_index+1]
150
-    done
167
+            APPS_CHOSEN[$app_index]="1"
168
+            app_index=$[app_index+1]
169
+        done
170
+    fi
151 171
 
152 172
     # if no apps to be installed then don't do anything
153 173
     if [ ${n} -eq 0 ]; then
@@ -181,10 +201,6 @@ fi
181 201
 
182 202
 detect_installable_apps
183 203
 
184
-if [[ $1 == "all"* ]]; then
185
-    choose_all_installable_apps
186
-fi
187
-
188 204
 # if no applications were found
189 205
 if [[ ${#APPS_AVAILABLE[@]} == 0 ]]; then
190 206
     exit 1
@@ -195,6 +211,10 @@ show_apps
195 211
 clear
196 212
 
197 213
 remove_apps_selected
198
-install_apps_selected
214
+if [[ $1 == "add-all" ]]; then
215
+    install_apps_selected add-all
216
+else
217
+    install_apps_selected
218
+fi
199 219
 
200 220
 exit 0

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

@@ -316,16 +316,6 @@ function detect_installable_apps {
316 316
     done
317 317
 }
318 318
 
319
-function choose_all_installable_apps {
320
-    # selects all of the apps
321
-    app_index=0
322
-    for a in "${APPS_AVAILABLE[@]}"
323
-    do
324
-        APPS_CHOSEN[$app_index]="1"
325
-        app_index=$[app_index+1]
326
-    done
327
-}
328
-
329 319
 # creates the APPS_AVAILABLE and APPS_CHOSEN arrays based on
330 320
 # the given variant name
331 321
 function choose_apps_for_variant {

+ 1
- 1
src/freedombone-utils-setup View File

@@ -535,7 +535,7 @@ function setup_apps {
535 535
     upgrade_apps
536 536
 
537 537
     if [[ $is_interactive == "menuconfig"* ]]; then
538
-        ${PROJECT_NAME}-addremove all
538
+        ${PROJECT_NAME}-addremove add-all
539 539
     fi
540 540
 
541 541
     if [[ $is_interactive == "noninteractive" || $is_interactive == "headless" ]]; then