summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bruce Park <r@robru.ca>2013-11-14 18:50:34 -0800
committerRobert Bruce Park <r@robru.ca>2013-11-14 18:50:34 -0800
commit4250423d98de817154bbf653f205e1377e66fc10 (patch)
treebd770c228b730f59dbb90e6e776dc36fe591b955
parent584e3a9b4bed54d671174555a184ef3f40ff8dff (diff)
Make fn_expire_backup more robust.
-rw-r--r--rsync_tmbackup.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh
index 7b0f7a6..5e12eda 100644
--- a/rsync_tmbackup.sh
+++ b/rsync_tmbackup.sh
@@ -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