Tidying of backup and restore
This commit is contained in:
parent
c9435e5c8f
commit
20dffe1b61
|
@ -91,16 +91,12 @@ function create_mirrors_user {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create_password='no'
|
create_password=1
|
||||||
if [ ! "$MY_MIRRORS_PASSWORD" ]; then
|
if [ ${#MY_MIRRORS_PASSWORD} -ge ${MINIMUM_PASSWORD_LENGTH} ]; then
|
||||||
create_password='yes'
|
create_password=
|
||||||
fi
|
|
||||||
if [ ${#MY_MIRRORS_PASSWORD} -lt ${MINIMUM_PASSWORD_LENGTH} ]; then
|
|
||||||
echo $'Password is too short. Creating new one.'
|
|
||||||
create_password='yes'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $create_password == 'yes' ]]; then
|
if [ $create_password ]; then
|
||||||
MY_MIRRORS_PASSWORD="$(openssl rand -base64 20 | cut -c1-18)"
|
MY_MIRRORS_PASSWORD="$(openssl rand -base64 20 | cut -c1-18)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -365,43 +365,37 @@ function backup_database_to_friend {
|
||||||
|
|
||||||
function backup_apps {
|
function backup_apps {
|
||||||
localremote=$1
|
localremote=$1
|
||||||
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
||||||
|
|
||||||
BACKUP_APPS_COMPLETED=()
|
BACKUP_APPS_COMPLETED=()
|
||||||
|
|
||||||
# for all the app scripts
|
detect_installable_apps
|
||||||
for filename in $FILES
|
get_apps_installed_names
|
||||||
|
|
||||||
|
for app_name in "${APPS_INSTALLED_NAMES[@]}"
|
||||||
do
|
do
|
||||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
echo $"Backup ${app_name}"
|
||||||
if [[ $(item_in_array ${app_name} ${BACKUP_APPS_COMPLETED[@]}) != 0 ]]; then
|
function_check backup_${localremote}_${app_name}
|
||||||
if [[ "$(app_is_installed $a)" == "1" ]]; then
|
backup_${localremote}_${app_name}
|
||||||
BACKUP_APPS_COMPLETED+=("${app_name}")
|
BACKUP_APPS_COMPLETED+=("${app_name}")
|
||||||
backup_${localremote}_${app_name}
|
echo $"Backup ${app_name} completed"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_apps {
|
function restore_apps {
|
||||||
localremote=$1
|
localremote=$1
|
||||||
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
||||||
|
|
||||||
RESTORE_APPS_COMPLETED=()
|
RESTORE_APPS_COMPLETED=()
|
||||||
|
|
||||||
# for all the app scripts
|
detect_installable_apps
|
||||||
for filename in $FILES
|
get_apps_installed_names
|
||||||
|
|
||||||
|
for app_name in "${APPS_INSTALLED_NAMES[@]}"
|
||||||
do
|
do
|
||||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
echo $"Restoring ${app_name}"
|
||||||
if [[ $RESTORE_APP == 'all' || $RESTORE_APP == "${app_name}" ]]; then
|
function_check restore_${localremote}_${app_name}
|
||||||
if [[ $(item_in_array ${app_name} ${RESTORE_APPS_COMPLETED[@]}) != 0 ]]; then
|
restore_${localremote}_${app_name}
|
||||||
function_check app_is_installed
|
RESTORE_APPS_COMPLETED+=("${app_name}")
|
||||||
if [[ "$(app_is_installed $a)" == "1" ]]; then
|
echo $"Restored ${app_name}"
|
||||||
RESTORE_APPS_COMPLETED+=("${app_name}")
|
|
||||||
function_check restore_${localremote}_${app_name}
|
|
||||||
restore_${localremote}_${app_name}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue