Initially select all apps for install in interactive mode

This commit is contained in:
Bob Mottram 2016-10-17 13:01:13 +01:00
parent 5161fee8f6
commit ad39b2c78d
3 changed files with 33 additions and 23 deletions

View File

@ -130,10 +130,13 @@ function remove_apps_selected {
}
function install_apps_selected {
select_all_apps=$1
# which apps need to be installed?
installs=""
app_index=0
n=0
if [ ! $select_all_apps ]; then
for a in "${APPS_INSTALLED[@]}"
do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
@ -148,6 +151,23 @@ function install_apps_selected {
fi
app_index=$[app_index+1]
done
fi
if [[ $select_all_apps == "add-all" ]]; then
for a in "${APPS_INSTALLED[@]}"
do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
if [ ${n} -gt 0 ]; then
installs="$installs ${APPS_AVAILABLE[$app_index]}"
else
installs="${APPS_AVAILABLE[$app_index]}"
fi
n=$[n+1]
fi
APPS_CHOSEN[$app_index]="1"
app_index=$[app_index+1]
done
fi
# if no apps to be installed then don't do anything
if [ ${n} -eq 0 ]; then
@ -181,10 +201,6 @@ fi
detect_installable_apps
if [[ $1 == "all"* ]]; then
choose_all_installable_apps
fi
# if no applications were found
if [[ ${#APPS_AVAILABLE[@]} == 0 ]]; then
exit 1
@ -195,6 +211,10 @@ show_apps
clear
remove_apps_selected
install_apps_selected
if [[ $1 == "add-all" ]]; then
install_apps_selected add-all
else
install_apps_selected
fi
exit 0

View File

@ -316,16 +316,6 @@ function detect_installable_apps {
done
}
function choose_all_installable_apps {
# selects all of the apps
app_index=0
for a in "${APPS_AVAILABLE[@]}"
do
APPS_CHOSEN[$app_index]="1"
app_index=$[app_index+1]
done
}
# creates the APPS_AVAILABLE and APPS_CHOSEN arrays based on
# the given variant name
function choose_apps_for_variant {

View File

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