Extra onion app checks

This commit is contained in:
Bob Mottram 2018-05-09 15:43:45 +01:00
parent a1a7e92d90
commit 352b259bbb
1 changed files with 57 additions and 37 deletions

View File

@ -285,12 +285,13 @@ function detect_apps {
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
APPS_AVAILABLE+=("${app_name}")
APPS_CHOSEN+=("0")
fi
fi
done
function_check get_apps_installed
@ -298,6 +299,20 @@ function detect_apps {
get_apps_installed_names
}
function app_not_on_onion_only {
app_name="$1"
read_config_param ONION_ONLY
if [[ "$ONION_ONLY" != 'no' ]]; then
if grep -q "NOT_ON_ONION=1" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"; then
echo "0"
return
fi
fi
echo "1"
}
# detects what apps are available and can be installed
# If the variants list within an app script is an empty string then
# it is considered to be too experimental to be installable
@ -318,6 +333,7 @@ function detect_installable_apps {
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
variants_list=$(app_variants "$filename")
@ -331,6 +347,7 @@ function detect_installable_apps {
fi
fi
fi
fi
done
}
@ -350,6 +367,7 @@ function detect_installed_apps {
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
if [[ $(app_is_installed "$app_name") == "1" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
@ -360,6 +378,7 @@ function detect_installed_apps {
fi
fi
fi
fi
done
}
@ -385,7 +404,7 @@ function choose_apps_for_variant {
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
if grep -q "VARIANTS=" "${filename}"; then
@ -408,6 +427,7 @@ function choose_apps_for_variant {
APPS_CHOSEN+=("0")
fi
fi
fi
done
function_check get_apps_installed