|
@@ -49,8 +49,8 @@ INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
|
49
|
49
|
# so that when a new app is added existing users can be added
|
50
|
50
|
APP_USERS_FILE=$HOME/app_users.txt
|
51
|
51
|
|
52
|
|
-if [ ! $COMPLETION_FILE ]; then
|
53
|
|
- COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
|
|
52
|
+if [ ! "$COMPLETION_FILE" ]; then
|
|
53
|
+ COMPLETION_FILE="$HOME/${PROJECT_NAME}-completed.txt"
|
54
|
54
|
fi
|
55
|
55
|
|
56
|
56
|
# Loads variables defined at the beginning of an app script
|
|
@@ -58,16 +58,20 @@ function app_load_variables {
|
58
|
58
|
app_name=$1
|
59
|
59
|
|
60
|
60
|
config_var_name=${app_name}_variables
|
|
61
|
+ # shellcheck disable=SC2086
|
61
|
62
|
if [ ! ${!config_var_name} ]; then
|
62
|
63
|
echo $"${app_name}_variables was not found"
|
63
|
64
|
return
|
64
|
65
|
fi
|
65
|
66
|
|
|
67
|
+ #shellcheck disable=SC1087,SC2125,SC2178
|
66
|
68
|
configvarname=$config_var_name[@]
|
|
69
|
+
|
|
70
|
+ #shellcheck disable=SC2206
|
67
|
71
|
configvarname=( ${!configvarname} )
|
68
|
72
|
for v in "${configvarname[@]}"
|
69
|
73
|
do
|
70
|
|
- read_config_param $v
|
|
74
|
+ read_config_param "$v"
|
71
|
75
|
done
|
72
|
76
|
}
|
73
|
77
|
|
|
@@ -76,22 +80,26 @@ function app_save_variables {
|
76
|
80
|
app_name=$1
|
77
|
81
|
|
78
|
82
|
config_var_name=${app_name}_variables
|
|
83
|
+ #shellcheck disable=SC2086
|
79
|
84
|
if [ ! ${!config_var_name} ]; then
|
80
|
85
|
return
|
81
|
86
|
fi
|
82
|
87
|
|
|
88
|
+ #shellcheck disable=SC1087,SC2125,SC2178
|
83
|
89
|
configvarname=$config_var_name[@]
|
|
90
|
+
|
|
91
|
+ #shellcheck disable=SC2206
|
84
|
92
|
configvarname=( ${!configvarname} )
|
85
|
93
|
for v in "${configvarname[@]}"
|
86
|
94
|
do
|
87
|
|
- write_config_param $v "${!v}"
|
|
95
|
+ write_config_param "$v" "${!v}"
|
88
|
96
|
done
|
89
|
97
|
}
|
90
|
98
|
|
91
|
99
|
# gets the variants list from an app script
|
92
|
100
|
function app_variants {
|
93
|
101
|
filename=$1
|
94
|
|
- variants_line=$(cat ${filename} | grep 'VARIANTS=')
|
|
102
|
+ variants_line=$(grep 'VARIANTS=' "${filename}")
|
95
|
103
|
if [[ "$variants_line" == *"'"* ]]; then
|
96
|
104
|
variants_list=$(echo "$variants_line" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')
|
97
|
105
|
else
|
|
@@ -112,21 +120,22 @@ function item_in_array {
|
112
|
120
|
function available_system_variants {
|
113
|
121
|
function_check item_in_array
|
114
|
122
|
|
115
|
|
- FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
123
|
+ FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
|
116
|
124
|
|
117
|
125
|
new_available_variants_list=()
|
118
|
126
|
for filename in $FILES
|
119
|
127
|
do
|
120
|
|
- system_variants_list=$(app_variants $filename)
|
|
128
|
+ system_variants_list=$(app_variants "$filename")
|
|
129
|
+ # shellcheck disable=SC2206
|
121
|
130
|
variants_array=($system_variants_list)
|
122
|
131
|
for variant_str in "${variants_array[@]}"
|
123
|
132
|
do
|
124
|
|
- item_in_array "${variant_str}" "${new_available_variants_list[@]}"
|
125
|
|
- if [[ $? != 0 ]]; then
|
|
133
|
+ if ! item_in_array "${variant_str}" "${new_available_variants_list[@]}"; then
|
126
|
134
|
new_available_variants_list+=("$variant_str")
|
127
|
135
|
fi
|
128
|
136
|
done
|
129
|
137
|
done
|
|
138
|
+ # shellcheck disable=SC2207
|
130
|
139
|
available_variants_list=($(sort <<<"${new_available_variants_list[*]}"))
|
131
|
140
|
}
|
132
|
141
|
|
|
@@ -167,11 +176,11 @@ function remove_app {
|
167
|
176
|
if ! grep -Fxq "_${app_name}_" $REMOVED_APPS_FILE; then
|
168
|
177
|
echo "_${app_name}_" >> $REMOVED_APPS_FILE
|
169
|
178
|
fi
|
170
|
|
- if grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
|
171
|
|
- sed -i "/install_${app_name}/d" $COMPLETION_FILE
|
|
179
|
+ if grep -Fxq "install_${app_name}" "$COMPLETION_FILE"; then
|
|
180
|
+ sed -i "/install_${app_name}/d" "$COMPLETION_FILE"
|
172
|
181
|
fi
|
173
|
|
- if grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
|
174
|
|
- sed -i "/install_${app_name}/d" $INSTALLED_APPS_LIST
|
|
182
|
+ if grep -Fxq "install_${app_name}" "$INSTALLED_APPS_LIST"; then
|
|
183
|
+ sed -i "/install_${app_name}/d" "$INSTALLED_APPS_LIST"
|
175
|
184
|
fi
|
176
|
185
|
}
|
177
|
186
|
|
|
@@ -196,7 +205,7 @@ function reinstall_app {
|
196
|
205
|
if [ ! -f $REMOVED_APPS_FILE ]; then
|
197
|
206
|
return
|
198
|
207
|
fi
|
199
|
|
- if [[ $(app_is_removed $app_name) == "1" ]]; then
|
|
208
|
+ if [[ $(app_is_removed "$app_name") == "1" ]]; then
|
200
|
209
|
sed -i "/_${app_name}_/d" $REMOVED_APPS_FILE
|
201
|
210
|
fi
|
202
|
211
|
}
|
|
@@ -207,8 +216,8 @@ function app_is_installed {
|
207
|
216
|
|
208
|
217
|
# Why does this secondary file exist, apart from COMPLETION_FILE ?
|
209
|
218
|
# It's so that it is visible to unprivileged users from the user control panel
|
210
|
|
- if [ -f $INSTALLED_APPS_LIST ]; then
|
211
|
|
- if ! grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
|
|
219
|
+ if [ -f "$INSTALLED_APPS_LIST" ]; then
|
|
220
|
+ if ! grep -Fxq "install_${app_name}" "$INSTALLED_APPS_LIST"; then
|
212
|
221
|
echo "0"
|
213
|
222
|
else
|
214
|
223
|
echo "1"
|
|
@@ -217,12 +226,12 @@ function app_is_installed {
|
217
|
226
|
fi
|
218
|
227
|
|
219
|
228
|
# check the completion file to see if it was installed
|
220
|
|
- if [ ! -f $COMPLETION_FILE ]; then
|
|
229
|
+ if [ ! -f "$COMPLETION_FILE" ]; then
|
221
|
230
|
echo "0"
|
222
|
231
|
return
|
223
|
232
|
fi
|
224
|
233
|
|
225
|
|
- if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
|
|
234
|
+ if ! grep -Fxq "install_${app_name}" "$COMPLETION_FILE"; then
|
226
|
235
|
echo "0"
|
227
|
236
|
else
|
228
|
237
|
echo "1"
|
|
@@ -231,11 +240,11 @@ function app_is_installed {
|
231
|
240
|
|
232
|
241
|
# called at the end of the install section of an app script
|
233
|
242
|
function install_completed {
|
234
|
|
- if [ ! ${1} ]; then
|
|
243
|
+ if [ ! "${1}" ]; then
|
235
|
244
|
exit 673935
|
236
|
245
|
fi
|
237
|
|
- if ! grep -Fxq "install_${1}" $COMPLETION_FILE; then
|
238
|
|
- echo "install_${1}" >> $COMPLETION_FILE
|
|
246
|
+ if ! grep -Fxq "install_${1}" "$COMPLETION_FILE"; then
|
|
247
|
+ echo "install_${1}" >> "$COMPLETION_FILE"
|
239
|
248
|
fi
|
240
|
249
|
}
|
241
|
250
|
|
|
@@ -243,7 +252,7 @@ function install_completed {
|
243
|
252
|
function get_apps_installed {
|
244
|
253
|
for a in "${APPS_AVAILABLE[@]}"
|
245
|
254
|
do
|
246
|
|
- APPS_INSTALLED+=("$(app_is_installed $a)")
|
|
255
|
+ APPS_INSTALLED+=("$(app_is_installed "$a")")
|
247
|
256
|
done
|
248
|
257
|
}
|
249
|
258
|
|
|
@@ -252,7 +261,7 @@ function get_apps_installed_names {
|
252
|
261
|
APPS_INSTALLED_NAMES=()
|
253
|
262
|
for a in "${APPS_AVAILABLE[@]}"
|
254
|
263
|
do
|
255
|
|
- if [[ $(app_is_installed $a) == "1" ]]; then
|
|
264
|
+ if [[ $(app_is_installed "$a") == "1" ]]; then
|
256
|
265
|
APPS_INSTALLED_NAMES+=("$a")
|
257
|
266
|
fi
|
258
|
267
|
done
|
|
@@ -260,7 +269,7 @@ function get_apps_installed_names {
|
260
|
269
|
|
261
|
270
|
# detects what apps are available
|
262
|
271
|
function detect_apps {
|
263
|
|
- FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
272
|
+ FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
|
264
|
273
|
|
265
|
274
|
function_check item_in_array
|
266
|
275
|
|
|
@@ -272,8 +281,7 @@ function detect_apps {
|
272
|
281
|
do
|
273
|
282
|
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
274
|
283
|
|
275
|
|
- item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
276
|
|
- if [[ $? != 0 ]]; then
|
|
284
|
+ if ! item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"; then
|
277
|
285
|
APPS_AVAILABLE+=("${app_name}")
|
278
|
286
|
APPS_CHOSEN+=("0")
|
279
|
287
|
fi
|
|
@@ -288,7 +296,7 @@ function detect_apps {
|
288
|
296
|
# If the variants list within an app script is an empty string then
|
289
|
297
|
# it is considered to be too experimental to be installable
|
290
|
298
|
function detect_installable_apps {
|
291
|
|
- FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
299
|
+ FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
|
292
|
300
|
|
293
|
301
|
APPS_AVAILABLE=()
|
294
|
302
|
APPS_CHOSEN=()
|
|
@@ -304,15 +312,14 @@ function detect_installable_apps {
|
304
|
312
|
do
|
305
|
313
|
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
306
|
314
|
|
307
|
|
- item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
308
|
|
- if [[ $? != 0 ]]; then
|
309
|
|
- variants_list=$(app_variants $filename)
|
|
315
|
+ if ! item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"; then
|
|
316
|
+ variants_list=$(app_variants "$filename")
|
310
|
317
|
# check for empty string
|
311
|
318
|
if [ ${#variants_list} -gt 0 ]; then
|
312
|
319
|
APPS_AVAILABLE+=("${app_name}")
|
313
|
320
|
APPS_CHOSEN+=("0")
|
314
|
|
- APPS_INSTALLED+=("$(app_is_installed $app_name)")
|
315
|
|
- if [[ $(app_is_installed $app_name) == "1" ]]; then
|
|
321
|
+ APPS_INSTALLED+=("$(app_is_installed "$app_name")")
|
|
322
|
+ if [[ $(app_is_installed "$app_name") == "1" ]]; then
|
316
|
323
|
APPS_INSTALLED_NAMES+=("$app_name")
|
317
|
324
|
fi
|
318
|
325
|
fi
|
|
@@ -321,7 +328,7 @@ function detect_installable_apps {
|
321
|
328
|
}
|
322
|
329
|
|
323
|
330
|
function detect_installed_apps {
|
324
|
|
- FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
331
|
+ FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
|
325
|
332
|
|
326
|
333
|
APPS_AVAILABLE=()
|
327
|
334
|
APPS_INSTALLED=()
|
|
@@ -336,10 +343,9 @@ function detect_installed_apps {
|
336
|
343
|
do
|
337
|
344
|
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
338
|
345
|
|
339
|
|
- if [[ $(app_is_installed $app_name) == "1" ]]; then
|
340
|
|
- item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
341
|
|
- if [[ $? != 0 ]]; then
|
342
|
|
- variants_list=$(app_variants $filename)
|
|
346
|
+ if [[ $(app_is_installed "$app_name") == "1" ]]; then
|
|
347
|
+ if ! item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"; then
|
|
348
|
+ variants_list=$(app_variants "$filename")
|
343
|
349
|
if [ ${#variants_list} -gt 0 ]; then
|
344
|
350
|
APPS_AVAILABLE+=("${app_name}")
|
345
|
351
|
APPS_INSTALLED_NAMES+=("$app_name")
|
|
@@ -363,7 +369,7 @@ function choose_apps_for_variant {
|
363
|
369
|
exit 237567
|
364
|
370
|
fi
|
365
|
371
|
|
366
|
|
- FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
372
|
+ FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
|
367
|
373
|
|
368
|
374
|
APPS_CHOSEN=()
|
369
|
375
|
|
|
@@ -372,16 +378,15 @@ function choose_apps_for_variant {
|
372
|
378
|
do
|
373
|
379
|
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
374
|
380
|
|
375
|
|
- item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
376
|
|
- if [[ $? == 0 ]]; then
|
377
|
|
- if grep -q "VARIANTS=" ${filename}; then
|
378
|
|
- variants_list=$(app_variants $filename)
|
|
381
|
+ if item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"; then
|
|
382
|
+ if grep -q "VARIANTS=" "${filename}"; then
|
|
383
|
+ variants_list=$(app_variants "$filename")
|
379
|
384
|
if [[ "${variants_list}" == 'all'* || \
|
380
|
385
|
"${variants_list}" == "$variant_name" || \
|
381
|
386
|
"${variants_list}" == "$variant_name "* || \
|
382
|
387
|
"${variants_list}" == *" $variant_name "* || \
|
383
|
388
|
"${variants_list}" == *" $variant_name" ]]; then
|
384
|
|
- if [[ $(app_is_removed ${a}) == "0" ]]; then
|
|
389
|
+ if [[ $(app_is_removed "${a}") == "0" ]]; then
|
385
|
390
|
#echo $"${app_name} chosen"
|
386
|
391
|
APPS_CHOSEN+=("1")
|
387
|
392
|
else
|
|
@@ -408,7 +413,7 @@ function list_chosen_apps {
|
408
|
413
|
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
|
409
|
414
|
echo $"${a}"
|
410
|
415
|
fi
|
411
|
|
- app_index=$[app_index+1]
|
|
416
|
+ app_index=$((app_index+1))
|
412
|
417
|
done
|
413
|
418
|
}
|
414
|
419
|
|
|
@@ -421,23 +426,23 @@ function remove_apps {
|
421
|
426
|
echo $"Removing users for application: ${a}"
|
422
|
427
|
|
423
|
428
|
function_check remove_users_for_app
|
424
|
|
- remove_users_for_app ${a}
|
|
429
|
+ remove_users_for_app "${a}"
|
425
|
430
|
|
426
|
431
|
echo $"Removing application: ${a}"
|
427
|
432
|
|
428
|
433
|
function_check app_load_variables
|
429
|
|
- app_load_variables ${a}
|
|
434
|
+ app_load_variables "${a}"
|
430
|
435
|
|
431
|
436
|
function_check remove_app
|
432
|
|
- remove_app ${a}
|
|
437
|
+ remove_app "${a}"
|
433
|
438
|
|
434
|
|
- function_check remove_${a}
|
435
|
|
- remove_${a}
|
|
439
|
+ function_check "remove_${a}"
|
|
440
|
+ "remove_${a}"
|
436
|
441
|
|
437
|
442
|
echo $"${a} was removed"
|
438
|
443
|
fi
|
439
|
444
|
fi
|
440
|
|
- app_index=$[app_index+1]
|
|
445
|
+ app_index=$((app_index+1))
|
441
|
446
|
done
|
442
|
447
|
update_installed_apps_list
|
443
|
448
|
}
|
|
@@ -450,13 +455,13 @@ function install_apps_interactive {
|
450
|
455
|
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
|
451
|
456
|
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
|
452
|
457
|
# interactively obtain settings for this app
|
453
|
|
- if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
|
454
|
|
- install_interactive_${a}
|
|
458
|
+ if [[ $(function_exists "install_interactive_${a}") == "1" ]]; then
|
|
459
|
+ "install_interactive_${a}"
|
455
|
460
|
fi
|
456
|
461
|
fi
|
457
|
462
|
fi
|
458
|
463
|
|
459
|
|
- app_index=$[app_index+1]
|
|
464
|
+ app_index=$((app_index+1))
|
460
|
465
|
done
|
461
|
466
|
echo $"Interactive settings complete"
|
462
|
467
|
}
|
|
@@ -466,8 +471,8 @@ function user_added_to_app {
|
466
|
471
|
app_name="$2"
|
467
|
472
|
|
468
|
473
|
if [[ $(is_valid_user "$user_name") == "1" ]]; then
|
469
|
|
- if [[ $(function_exists add_user_${app_name}) == "1" ]]; then
|
470
|
|
- if grep -Fxq "${app_name}_${user_name}" $APP_USERS_FILE; then
|
|
474
|
+ if [[ $(function_exists "add_user_${app_name}") == "1" ]]; then
|
|
475
|
+ if grep -Fxq "${app_name}_${user_name}" "$APP_USERS_FILE"; then
|
471
|
476
|
echo "1"
|
472
|
477
|
return
|
473
|
478
|
fi
|
|
@@ -482,7 +487,7 @@ function add_users_after_install {
|
482
|
487
|
read_config_param MY_USERNAME
|
483
|
488
|
|
484
|
489
|
# ensure a minimum password length
|
485
|
|
- if [ ! $MINIMUM_PASSWORD_LENGTH ]; then
|
|
490
|
+ if [ ! "$MINIMUM_PASSWORD_LENGTH" ]; then
|
486
|
491
|
MINIMUM_PASSWORD_LENGTH=20
|
487
|
492
|
fi
|
488
|
493
|
if [ ${#MINIMUM_PASSWORD_LENGTH} -lt 20 ]; then
|
|
@@ -490,7 +495,7 @@ function add_users_after_install {
|
490
|
495
|
fi
|
491
|
496
|
|
492
|
497
|
ADMIN_USERNAME=$(get_completion_param "Admin user")
|
493
|
|
- if [ ! $ADMIN_USERNAME ]; then
|
|
498
|
+ if [ ! "$ADMIN_USERNAME" ]; then
|
494
|
499
|
ADMIN_USERNAME=$MY_USERNAME
|
495
|
500
|
fi
|
496
|
501
|
|
|
@@ -501,8 +506,8 @@ function add_users_after_install {
|
501
|
506
|
if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "0" ]]; then
|
502
|
507
|
valstr=$"Login for user ${USERNAME}="
|
503
|
508
|
app_password="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
504
|
|
- add_user_${app_name} "${USERNAME}" "${app_password}"
|
505
|
|
- echo "${app_name}_${USERNAME}" >> $APP_USERS_FILE
|
|
509
|
+ "add_user_${app_name}" "${USERNAME}" "${app_password}"
|
|
510
|
+ echo "${app_name}_${USERNAME}" >> "$APP_USERS_FILE"
|
506
|
511
|
fi
|
507
|
512
|
fi
|
508
|
513
|
fi
|
|
@@ -519,10 +524,10 @@ function remove_users_for_app {
|
519
|
524
|
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
520
|
525
|
if [[ "$USERNAME" != "$MY_USERNAME" ]]; then
|
521
|
526
|
if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "1" ]]; then
|
522
|
|
- if [[ $(function_exists remove_user_${app_name}) == "1" ]]; then
|
523
|
|
- remove_user_${app_name} "${USERNAME}"
|
|
527
|
+ if [[ $(function_exists "remove_user_${app_name}") == "1" ]]; then
|
|
528
|
+ "remove_user_${app_name}" "${USERNAME}"
|
524
|
529
|
fi
|
525
|
|
- sed -i "/${app_name}_${USERNAME}/d" $APP_USERS_FILE
|
|
530
|
+ sed -i "/${app_name}_${USERNAME}/d" "$APP_USERS_FILE"
|
526
|
531
|
fi
|
527
|
532
|
fi
|
528
|
533
|
fi
|
|
@@ -535,7 +540,7 @@ function install_apps {
|
535
|
540
|
APP_INSTALLED_SUCCESS=1
|
536
|
541
|
|
537
|
542
|
# interactive install configuration for each app
|
538
|
|
- if [ ${is_interactive} ]; then
|
|
543
|
+ if [ "${is_interactive}" ]; then
|
539
|
544
|
install_apps_interactive
|
540
|
545
|
fi
|
541
|
546
|
|
|
@@ -549,69 +554,69 @@ function install_apps {
|
549
|
554
|
# remove any temp files
|
550
|
555
|
rm -rf /tmp/*
|
551
|
556
|
|
552
|
|
- if [ ${is_interactive} ]; then
|
|
557
|
+ if [ "${is_interactive}" ]; then
|
553
|
558
|
# clears any removal indicator
|
554
|
559
|
function_check reinstall_app
|
555
|
|
- reinstall_app ${a}
|
|
560
|
+ reinstall_app "${a}"
|
556
|
561
|
|
557
|
562
|
function_check app_load_variables
|
558
|
|
- app_load_variables ${a}
|
|
563
|
+ app_load_variables "${a}"
|
559
|
564
|
|
560
|
|
- if [[ $(app_is_installed ${a}) == "1" ]]; then
|
|
565
|
+ if [[ $(app_is_installed "${a}") == "1" ]]; then
|
561
|
566
|
echo $"Upgrading application from interactive: ${a}"
|
562
|
|
- upgrade_${a}
|
|
567
|
+ "upgrade_${a}"
|
563
|
568
|
echo $"${a} was upgraded from interactive"
|
564
|
569
|
else
|
565
|
570
|
echo $"Installing application from interactive: ${a}"
|
566
|
571
|
APP_INSTALLED=
|
567
|
|
- install_${a}
|
|
572
|
+ "install_${a}"
|
568
|
573
|
if [ $APP_INSTALLED ]; then
|
569
|
574
|
function_check app_save_variables
|
570
|
|
- app_save_variables ${a}
|
|
575
|
+ app_save_variables "${a}"
|
571
|
576
|
|
572
|
577
|
function_check add_users_after_install
|
573
|
|
- add_users_after_install ${a}
|
|
578
|
+ add_users_after_install "${a}"
|
574
|
579
|
|
575
|
580
|
function_check lockdown_permissions
|
576
|
581
|
lockdown_permissions
|
577
|
582
|
|
578
|
583
|
function_check install_completed
|
579
|
|
- install_completed ${a}
|
|
584
|
+ install_completed "${a}"
|
580
|
585
|
echo $"${a} was installed from interactive"
|
581
|
586
|
else
|
582
|
|
- echo "Failed to install: ${a}" >> /var/log/${PROJECT_NAME}.log
|
|
587
|
+ echo "Failed to install: ${a}" >> "/var/log/${PROJECT_NAME}.log"
|
583
|
588
|
APP_INSTALLED_SUCCESS=
|
584
|
589
|
echo $"${a} was not installed from interactive"
|
585
|
590
|
fi
|
586
|
591
|
fi
|
587
|
592
|
else
|
588
|
593
|
# check if the app was removed
|
589
|
|
- if [[ $(app_is_removed ${a}) == "0" ]]; then
|
|
594
|
+ if [[ $(app_is_removed "${a}") == "0" ]]; then
|
590
|
595
|
function_check app_load_variables
|
591
|
|
- app_load_variables ${a}
|
592
|
|
- if [[ $(app_is_installed ${a}) == "1" ]]; then
|
|
596
|
+ app_load_variables "${a}"
|
|
597
|
+ if [[ $(app_is_installed "${a}") == "1" ]]; then
|
593
|
598
|
echo $"Upgrading application: ${a}"
|
594
|
|
- upgrade_${a}
|
|
599
|
+ "upgrade_${a}"
|
595
|
600
|
echo $"${a} was upgraded"
|
596
|
601
|
else
|
597
|
602
|
echo $"Installing application: ${a}"
|
598
|
603
|
APP_INSTALLED=
|
599
|
|
- install_${a}
|
|
604
|
+ "install_${a}"
|
600
|
605
|
if [ $APP_INSTALLED ]; then
|
601
|
606
|
function_check app_save_variables
|
602
|
|
- app_save_variables ${a}
|
|
607
|
+ app_save_variables "${a}"
|
603
|
608
|
|
604
|
609
|
function_check add_users_after_install
|
605
|
|
- add_users_after_install ${a}
|
|
610
|
+ add_users_after_install "${a}"
|
606
|
611
|
|
607
|
612
|
function_check lockdown_permissions
|
608
|
613
|
lockdown_permissions
|
609
|
614
|
|
610
|
615
|
function_check install_completed
|
611
|
|
- install_completed ${a}
|
|
616
|
+ install_completed "${a}"
|
612
|
617
|
echo $"${a} was installed"
|
613
|
618
|
else
|
614
|
|
- echo "Failed to install: ${a}" >> /var/log/${PROJECT_NAME}.log
|
|
619
|
+ echo "Failed to install: ${a}" >> "/var/log/${PROJECT_NAME}.log"
|
615
|
620
|
APP_INSTALLED_SUCCESS=
|
616
|
621
|
echo $"${a} was not installed"
|
617
|
622
|
fi
|
|
@@ -622,7 +627,7 @@ function install_apps {
|
622
|
627
|
fi
|
623
|
628
|
fi
|
624
|
629
|
fi
|
625
|
|
- app_index=$[app_index+1]
|
|
630
|
+ app_index=$((app_index+1))
|
626
|
631
|
done
|
627
|
632
|
|
628
|
633
|
function_check update_installed_apps_list
|