浏览代码

Option for interactive install function

Bob Mottram 8 年前
父节点
当前提交
dce19538ac
共有 3 个文件被更改,包括 17 次插入3 次删除
  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 查看文件

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

+ 9
- 2
src/freedombone-utils-depends 查看文件

30
 
30
 
31
 function function_check {
31
 function function_check {
32
     if [ ! "$(type ${1} 2>/dev/null)" ]; then
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
     fi
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
 # NOTE: deliberately there is no "exit 0"
46
 # NOTE: deliberately there is no "exit 0"

+ 7
- 0
src/freedombone-utils-selector 查看文件

202
 }
202
 }
203
 
203
 
204
 function install_apps {
204
 function install_apps {
205
+    is_interactive=$1
205
     app_index=0
206
     app_index=0
206
     for a in "${APPS_AVAILABLE[@]}"
207
     for a in "${APPS_AVAILABLE[@]}"
207
     do
208
     do
208
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
209
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
209
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
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
                 echo $"Installing application: ${a}"
217
                 echo $"Installing application: ${a}"
211
                 install_${a}
218
                 install_${a}
212
                 echo $"${a} was installed"
219
                 echo $"${a} was installed"