Fix testing of items in an array
This commit is contained in:
parent
b6188eb42d
commit
d50ee1761e
|
@ -76,7 +76,7 @@ function app_save_variables {
|
|||
# gets the variants list from an app script
|
||||
function app_variants {
|
||||
filename=$1
|
||||
variants_line=$(cat ${filename} | grep "VARIANTS=")
|
||||
variants_line=$(cat ${filename} | grep 'VARIANTS=')
|
||||
if [[ "$variants_line" == *"'"* ]]; then
|
||||
variants_list=$(echo "$variants_line" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')
|
||||
else
|
||||
|
@ -97,13 +97,15 @@ function item_in_array {
|
|||
function available_system_variants {
|
||||
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
||||
|
||||
available_variants_list=()
|
||||
for filename in $FILES
|
||||
do
|
||||
variants_list=$(app_variants $filename)
|
||||
variants_array=($variants_list)
|
||||
for variant_str in "${vars[@]}"
|
||||
system_variants_list=$(app_variants $filename)
|
||||
variants_array=($system_variants_list)
|
||||
for variant_str in "${variants_array[@]}"
|
||||
do
|
||||
if [[ $(item_in_array "$variant_str" ${available_variants_list[@]}) == "0" ]]; then
|
||||
item_in_array "${variant_str}" "${available_variants_list[@]}"
|
||||
if [[ $? != 0 ]]; then
|
||||
available_variants_list+=("$variant_str")
|
||||
fi
|
||||
done
|
||||
|
@ -238,7 +240,9 @@ function detect_apps {
|
|||
for filename in $FILES
|
||||
do
|
||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
||||
if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then
|
||||
|
||||
item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
||||
if [[ $? != 0 ]]; then
|
||||
APPS_AVAILABLE+=("${app_name}")
|
||||
APPS_CHOSEN+=("0")
|
||||
fi
|
||||
|
@ -266,7 +270,9 @@ function detect_installable_apps {
|
|||
for filename in $FILES
|
||||
do
|
||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
||||
if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then
|
||||
|
||||
item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
||||
if [[ $? != 0 ]]; then
|
||||
variants_list=$(app_variants $filename)
|
||||
# check for empty string
|
||||
if [ ${#variants_list} -gt 0 ]; then
|
||||
|
@ -295,7 +301,9 @@ function choose_apps_for_variant {
|
|||
for filename in $FILES
|
||||
do
|
||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
||||
if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then
|
||||
|
||||
item_in_array "${app_name}" "${APPS_AVAILABLE[@]}"
|
||||
if [[ $? != 0 ]]; then
|
||||
APPS_AVAILABLE+=("${app_name}")
|
||||
|
||||
if grep -q "VARIANTS=" ${filename}; then
|
||||
|
|
|
@ -489,7 +489,9 @@ function upgrade_apps {
|
|||
for filename in $FILES
|
||||
do
|
||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
||||
if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
|
||||
|
||||
item_in_array "${app_name}" "${APPS_COMPLETED[@]}"
|
||||
if [[ $? != 0 ]]; then
|
||||
function_check app_is_installed
|
||||
if [[ "$(app_is_installed $a)" == "1" ]]; then
|
||||
APPS_COMPLETED+=("${app_name}")
|
||||
|
|
Loading…
Reference in New Issue