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

Increment counters during backup and restore

parent b6bfb77e
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,8 @@ if [ -f /usr/bin/${PROJECT_NAME} ]; then
PROJECT_INSTALL_DIR=/usr/bin
fi
backup_counter=0
function please_wait {
local str width height length
......@@ -211,6 +213,7 @@ function backup_users {
fi
gpg_agent_enable "$USERNAME"
increment_backup_progress
fi
done
}
......@@ -388,12 +391,24 @@ if [[ "$backup_device" == "simple" || "$backup_device" == "detect" || "$backup_d
fi
fi
increment_backup_progress
gpg_agent_setup root
increment_backup_progress
backup_mount_drive "$backup_device" "$2"
increment_backup_progress
remove_backup_directory "$remove_option"
increment_backup_progress
make_backup_directory
increment_backup_progress
check_storage_space_remaining
increment_backup_progress
backup_users
prepare_directories
backup_directories
backup_apps local
......
......@@ -46,6 +46,8 @@ fi
# MariaDB password
DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
restore_counter=0
function please_wait {
local str width height length
......
......@@ -39,6 +39,9 @@ BACKUP_GPG_OPTIONS="--pinentry-mode loopback"
# This is used to detect drives later connected
DRIVES_BASELINE_FILE=/root/.drives_baseline
backup_progress_file=/root/.backup_progress.txt
function create_backups_temp_directory {
if [ ! -d $BACKUP_TEMP_DIRECTORY ]; then
mkdir $BACKUP_TEMP_DIRECTORY
......@@ -315,6 +318,16 @@ function backup_directory_to_usb_duplicity {
remove_backups_temp_directory
}
function increment_backup_progress {
backup_counter=$((backup_counter + 1))
echo -n "$backup_counter" > "$backup_progress_file"
}
function increment_restore_progress {
restore_counter=$((restore_counter + 1))
echo -n "$restore_counter" > "$restore_progress_file"
}
function backup_directory_to_usb {
if [ ! -d "${1}" ]; then
echo $"WARNING: directory does not exist: ${1}"
......@@ -338,6 +351,8 @@ function backup_directory_to_usb {
if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
rm -rf "${1}"
fi
increment_backup_progress
fi
}
......@@ -366,6 +381,7 @@ function restore_directory_from_usb {
mkdir "${1}"
fi
restore_directory_from_usb_duplicity "${1}" "${2}"
increment_restore_progress
}
function restore_directory_from_friend_duplicity {
......@@ -397,6 +413,8 @@ function backup_database_to_usb {
echo $"Error backing up ${1} database to ${local_database_dir}/${1}.sql"
exit 62383
fi
increment_backup_progress
backup_directory_to_usb "${local_database_dir}" "${database_name}data"
}
......
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