Consolidate backup_apps

This commit is contained in:
Bob Mottram 2016-07-09 22:49:35 +01:00
parent b0d9459743
commit b62ffd74b6
3 changed files with 21 additions and 23 deletions

View File

@ -249,26 +249,6 @@ function backup_directories {
done
}
function backup_apps {
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
APPS_COMPLETED=()
# for all the app scripts
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
function_check app_is_installed
if [[ "$(app_is_installed $a)" == "1" ]]; then
APPS_COMPLETED+=("${app_name}")
function_check backup_local_${app_name}
backup_local_${app_name}
fi
fi
done
}
function remove_backup_directory {
if [ $1 ]; then
if [[ $1 == "remove" ]]; then
@ -420,7 +400,7 @@ check_storage_space_remaining
backup_users
prepare_directories
backup_directories
backup_apps
backup_apps local
backup_configuration
backup_admin_readme
backup_mariadb

View File

@ -424,8 +424,7 @@ if [[ $TEST_MODE == "no" ]]; then
backup_mariadb
backup_certs
backup_mailing_list
backup_apps remote
backup_extra_directories
fi

View File

@ -363,4 +363,23 @@ function backup_database_to_friend {
backup_directory_to_friend /root/temp${database_name}data ${database_name}data
}
function backup_apps {
localremote=$1
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
BACKUP_APPS_COMPLETED=()
# for all the app scripts
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(item_in_array ${app_name} ${BACKUP_APPS_COMPLETED[@]}) != 0 ]]; then
if [[ "$(app_is_installed $a)" == "1" ]]; then
BACKUP_APPS_COMPLETED+=("${app_name}")
backup_${localremote}_${app_name}
fi
fi
done
}
# NOTE: deliberately no exit 0