Make fn_expire_backup more robust.
This commit is contained in:
+7
-7
@@ -41,6 +41,13 @@ fn_find_backups() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn_expire_backup() {
|
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"
|
fn_log_info "Expiring $1"
|
||||||
rm -rf -- "$1"
|
rm -rf -- "$1"
|
||||||
}
|
}
|
||||||
@@ -258,13 +265,6 @@ while [ "1" ]; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
fn_expire_backup "$OLD_BACKUP_PATH"
|
||||||
|
|
||||||
# Resume backup
|
# Resume backup
|
||||||
|
|||||||
Reference in New Issue
Block a user