Browse Source

Option for interactive install function

Bob Mottram 8 years ago
parent
commit
dce19538ac
3 changed files with 17 additions and 3 deletions
  1. 1
    1
      src/freedombone-addremove
  2. 9
    2
      src/freedombone-utils-depends
  3. 7
    0
      src/freedombone-utils-selector

+ 1
- 1
src/freedombone-addremove View File

@@ -164,7 +164,7 @@ function install_apps_interactive {
164 164
 
165 165
     # install the apps
166 166
     read_configuration
167
-    install_apps
167
+    install_apps interactive
168 168
 }
169 169
 
170 170
 ${PROJECT_NAME}-tests

+ 9
- 2
src/freedombone-utils-depends View File

@@ -30,10 +30,17 @@
30 30
 
31 31
 function function_check {
32 32
     if [ ! "$(type ${1} 2>/dev/null)" ]; then
33
-		echo $"Dependency error: The function ${1} has not been defined"
34
-		exit 72528
33
+        echo $"Dependency error: The function ${1} has not been defined"
34
+        exit 72528
35 35
     fi
36 36
 }
37 37
 
38
+function function_exists {
39
+    if [ ! "$(type ${1} 2>/dev/null)" ]; then
40
+        echo "0"
41
+    else
42
+        echo "1"
43
+    fi
44
+}
38 45
 
39 46
 # NOTE: deliberately there is no "exit 0"

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

@@ -202,11 +202,18 @@ function remove_apps {
202 202
 }
203 203
 
204 204
 function install_apps {
205
+    is_interactive=$1
205 206
     app_index=0
206 207
     for a in "${APPS_AVAILABLE[@]}"
207 208
     do
208 209
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
209 210
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
211
+                if [ ${is_interactive} ]; then
212
+                    # interactively obtain settings for this app
213
+                    if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
214
+                        install_interactive_${a}
215
+                    fi
216
+                fi
210 217
                 echo $"Installing application: ${a}"
211 218
                 install_${a}
212 219
                 echo $"${a} was installed"