Skip to content
Snippets Groups Projects
Commit 20dffe1b authored by Bob Mottram's avatar Bob Mottram
Browse files

Tidying of backup and restore

parent c9435e5c
No related branches found
No related tags found
No related merge requests found
......@@ -91,16 +91,12 @@ function create_mirrors_user {
return
fi
create_password='no'
if [ ! "$MY_MIRRORS_PASSWORD" ]; then
create_password='yes'
fi
if [ ${#MY_MIRRORS_PASSWORD} -lt ${MINIMUM_PASSWORD_LENGTH} ]; then
echo $'Password is too short. Creating new one.'
create_password='yes'
create_password=1
if [ ${#MY_MIRRORS_PASSWORD} -ge ${MINIMUM_PASSWORD_LENGTH} ]; then
create_password=
fi
if [[ $create_password == 'yes' ]]; then
if [ $create_password ]; then
MY_MIRRORS_PASSWORD="$(openssl rand -base64 20 | cut -c1-18)"
fi
......
......@@ -365,43 +365,37 @@ function backup_database_to_friend {
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
detect_installable_apps
get_apps_installed_names
for app_name in "${APPS_INSTALLED_NAMES[@]}"
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
echo $"Backup ${app_name}"
function_check backup_${localremote}_${app_name}
backup_${localremote}_${app_name}
BACKUP_APPS_COMPLETED+=("${app_name}")
echo $"Backup ${app_name} completed"
done
}
function restore_apps {
localremote=$1
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
RESTORE_APPS_COMPLETED=()
# for all the app scripts
for filename in $FILES
detect_installable_apps
get_apps_installed_names
for app_name in "${APPS_INSTALLED_NAMES[@]}"
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $RESTORE_APP == 'all' || $RESTORE_APP == "${app_name}" ]]; then
if [[ $(item_in_array ${app_name} ${RESTORE_APPS_COMPLETED[@]}) != 0 ]]; then
function_check app_is_installed
if [[ "$(app_is_installed $a)" == "1" ]]; then
RESTORE_APPS_COMPLETED+=("${app_name}")
function_check restore_${localremote}_${app_name}
restore_${localremote}_${app_name}
fi
fi
fi
echo $"Restoring ${app_name}"
function_check restore_${localremote}_${app_name}
restore_${localremote}_${app_name}
RESTORE_APPS_COMPLETED+=("${app_name}")
echo $"Restored ${app_name}"
done
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment