Make fn_expire_backup more robust.

This commit is contained in:
Robert Bruce Park
2013-11-14 18:50:34 -08:00
parent 584e3a9b4b
commit 4250423d98
+7 -7
View File
@@ -41,6 +41,13 @@ fn_find_backups() {
}
fn_expire_backup() {
# Double-check that we're on a backup destination to be completely
# sure we're deleting the right folder
if [ "$(fn_is_backup_destination $(dirname -- "$1"))" != "1" ]; then
fn_log_error "$1 is not on a backup destination - aborting."
exit 1
fi
fn_log_info "Expiring $1"
rm -rf -- "$1"
}
@@ -258,13 +265,6 @@ while [ "1" ]; do
exit 1
fi
# Double-check that we're on a backup destination to be completely sure we're deleting the right folder
OLD_BACKUP_PARENT_PATH=$(dirname -- "$OLD_BACKUP_PATH")
if [ "$(fn_is_backup_destination $OLD_BACKUP_PARENT_PATH)" != "1" ]; then
fn_log_error "'$OLD_BACKUP_PATH' is not on a backup destination - aborting."
exit 1
fi
fn_expire_backup "$OLD_BACKUP_PATH"
# Resume backup