Choosing a variant

This commit is contained in:
Bob Mottram 2016-10-09 22:17:33 +01:00
parent 5025c5c227
commit c9f8427ecb
2 changed files with 11 additions and 10 deletions

View File

@ -773,11 +773,10 @@ function choose_full_name {
function choose_system_variant {
available_variants_list=()
variants_list=$(available_system_variants)
available_system_variants
varslist=""
n=1
vars_index=0
for a in "${available_variants_list[@]}"
do
varstate='off'
@ -786,17 +785,18 @@ function choose_system_variant {
fi
varslist="$varslist $n $a $varstate"
n=$[n+1]
vars_index=$[vars_index+1]
done
variant_choice=$(dialog --stdout --backtitle $"Freedombone Configuration" \
--title $"Type of Installation" \
--radiolist $'Choose:' \
27 40 20 $varslist)
variant_choice=$((variant_choice - 1))
export SYSTEM_TYPE=${variants_list[$variant_choice]}
save_configuration_values
write_config_param "SYSTEM_TYPE" "$SYSTEM_TYPE"
if [ $? -eq 0 ]; then
variant_choice=$[variant_choice-1]
SYSTEM_TYPE=${available_variants_list[$variant_choice]}
save_configuration_values
fi
}
function validate_freedns_code {

View File

@ -99,19 +99,20 @@ function item_in_array {
function available_system_variants {
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
available_variants_list=()
new_available_variants_list=()
for filename in $FILES
do
system_variants_list=$(app_variants $filename)
variants_array=($system_variants_list)
for variant_str in "${variants_array[@]}"
do
item_in_array "${variant_str}" "${available_variants_list[@]}"
item_in_array "${variant_str}" "${new_available_variants_list[@]}"
if [[ $? != 0 ]]; then
available_variants_list+=("$variant_str")
new_available_variants_list+=("$variant_str")
fi
done
done
available_variants_list=($(sort <<<"${new_available_variants_list[*]}"))
}
function is_valid_variant {