App install logic

This commit is contained in:
Bob Mottram 2016-10-01 09:48:57 +01:00
parent 6c143c31f2
commit 56df73944e
1 changed files with 15 additions and 12 deletions

View File

@ -283,35 +283,38 @@ function remove_apps {
function install_apps { function install_apps {
is_interactive=$1 is_interactive=$1
app_index=0 # interactive install configuration for each app
for a in "${APPS_AVAILABLE[@]}" if [ ${is_interactive} ]; then
do app_index=0
if [[ $(app_is_removed ${a}) == "0" ]]; then for a in "${APPS_AVAILABLE[@]}"
do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
if [ ${is_interactive} ]; then # interactively obtain settings for this app
# interactively obtain settings for this app if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
if [[ $(function_exists install_interactive_${a}) == "1" ]]; then install_interactive_${a}
install_interactive_${a}
fi
fi fi
fi fi
fi fi
fi app_index=$[app_index+1]
app_index=$[app_index+1] done
done fi
# now install the apps
app_index=0 app_index=0
for a in "${APPS_AVAILABLE[@]}" for a in "${APPS_AVAILABLE[@]}"
do do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
if [ ${is_interactive} ]; then if [ ${is_interactive} ]; then
# clears any removal indicator
reinstall_app ${a} reinstall_app ${a}
echo $"Installing application from interactive: ${a}" echo $"Installing application from interactive: ${a}"
install_${a} install_${a}
echo $"${a} was installed from interactive" echo $"${a} was installed from interactive"
else else
# check if the app was removed
if [[ $(app_is_removed ${a}) == "0" ]]; then if [[ $(app_is_removed ${a}) == "0" ]]; then
echo $"Installing application: ${a}" echo $"Installing application: ${a}"
install_${a} install_${a}