Function checks

This commit is contained in:
Bob Mottram 2016-10-15 13:59:56 +01:00
parent dd6b3b5d94
commit 9783a402cc
1 changed files with 31 additions and 0 deletions

View File

@ -106,6 +106,8 @@ function item_in_array {
# returns a list of available system variants # returns a list of available system variants
# based upon the variants string in each app script # based upon the variants string in each app script
function available_system_variants { function available_system_variants {
function_check item_in_array
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
new_available_variants_list=() new_available_variants_list=()
@ -127,6 +129,8 @@ function available_system_variants {
function is_valid_variant { function is_valid_variant {
sys_type="$1" sys_type="$1"
available_variants_list=() available_variants_list=()
function_check available_system_variants
available_system_variants available_system_variants
for variant_str in "${available_variants_list[@]}" for variant_str in "${available_variants_list[@]}"
@ -140,6 +144,8 @@ function is_valid_variant {
function show_available_variants { function show_available_variants {
available_variants_list=() available_variants_list=()
function_check available_system_variants
available_system_variants available_system_variants
for variant_str in "${available_variants_list[@]}" for variant_str in "${available_variants_list[@]}"
@ -250,6 +256,8 @@ function get_apps_installed_names {
function detect_apps { function detect_apps {
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
function_check item_in_array
APPS_AVAILABLE=() APPS_AVAILABLE=()
APPS_CHOSEN=() APPS_CHOSEN=()
@ -281,7 +289,9 @@ function detect_installable_apps {
APPS_INSTALLED=() APPS_INSTALLED=()
APPS_INSTALLED_NAMES=() APPS_INSTALLED_NAMES=()
function_check app_variants
function_check app_is_installed function_check app_is_installed
function_check item_in_array
# for all the app scripts # for all the app scripts
for filename in $FILES for filename in $FILES
@ -309,6 +319,10 @@ function detect_installable_apps {
function choose_apps_for_variant { function choose_apps_for_variant {
variant_name="$1" variant_name="$1"
function_check item_in_array
function_check app_variants
function_check app_is_removed
if [ ${#variant_name} -eq 0 ]; then if [ ${#variant_name} -eq 0 ]; then
echo $"No variant name for choosing apps" echo $"No variant name for choosing apps"
exit 237567 exit 237567
@ -370,9 +384,16 @@ function remove_apps {
if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
echo $"Removing application: ${a}" echo $"Removing application: ${a}"
function_check app_load_variables
app_load_variables ${a} app_load_variables ${a}
function_check remove_app
remove_app ${a} remove_app ${a}
function_check remove_${a}
remove_${a} remove_${a}
echo $"${a} was removed" echo $"${a} was removed"
fi fi
fi fi
@ -417,8 +438,10 @@ function install_apps {
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 # clears any removal indicator
function_check reinstall_app
reinstall_app ${a} reinstall_app ${a}
function_check app_load_variables
app_load_variables ${a} app_load_variables ${a}
if [[ $(app_is_installed ${a}) == "1" ]]; then if [[ $(app_is_installed ${a}) == "1" ]]; then
@ -430,7 +453,10 @@ function install_apps {
APP_INSTALLED= APP_INSTALLED=
install_${a} install_${a}
if [ $APP_INSTALLED ]; then if [ $APP_INSTALLED ]; then
function_check app_save_variables
app_save_variables ${a} app_save_variables ${a}
function_check install_completed
install_completed ${a} install_completed ${a}
echo $"${a} was installed from interactive" echo $"${a} was installed from interactive"
else else
@ -440,6 +466,7 @@ function install_apps {
else else
# check if the app was removed # check if the app was removed
if [[ $(app_is_removed ${a}) == "0" ]]; then if [[ $(app_is_removed ${a}) == "0" ]]; then
function_check app_load_variables
app_load_variables ${a} app_load_variables ${a}
if [[ $(app_is_installed ${a}) == "1" ]]; then if [[ $(app_is_installed ${a}) == "1" ]]; then
echo $"Upgrading application: ${a}" echo $"Upgrading application: ${a}"
@ -450,7 +477,10 @@ function install_apps {
APP_INSTALLED= APP_INSTALLED=
install_${a} install_${a}
if [ $APP_INSTALLED ]; then if [ $APP_INSTALLED ]; then
function_check app_save_variables
app_save_variables ${a} app_save_variables ${a}
function_check install_completed
install_completed ${a} install_completed ${a}
echo $"${a} was installed" echo $"${a} was installed"
else else
@ -466,6 +496,7 @@ function install_apps {
app_index=$[app_index+1] app_index=$[app_index+1]
done done
function_check update_installed_apps_list
update_installed_apps_list update_installed_apps_list
} }