diff options
| author | Robert Bruce Park <r@robru.ca> | 2013-11-14 19:03:26 -0800 |
|---|---|---|
| committer | Robert Bruce Park <r@robru.ca> | 2013-11-14 19:03:26 -0800 |
| commit | 855c77a83f1db1da041b1d14bb114378bed64855 (patch) | |
| tree | 8528a2f83f9a6cf02825158883cb734ce76ef107 | |
| parent | 4250423d98de817154bbf653f205e1377e66fc10 (diff) | |
Simplify fn_is_backup_destination implementation.
| -rw-r--r-- | rsync_tmbackup.sh | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 5e12eda..883415c 100644 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -43,7 +43,7 @@ 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 + if [ -z "$(fn_is_backup_destination "$(dirname -- "$1")")" ]; then fn_log_error "$1 is not on a backup destination - aborting." exit 1 fi @@ -78,15 +78,10 @@ fn_backup_marker_path() { } fn_is_backup_destination() { - DEST_MARKER_FILE="$(fn_backup_marker_path $1)" - if [ -f "$DEST_MARKER_FILE" ]; then - echo "1" - else - echo "0" - fi + find "$(fn_backup_marker_path "$1")" 2>/dev/null } -if [ "$(fn_is_backup_destination $DEST_FOLDER)" != "1" ]; then +if [ -z "$(fn_is_backup_destination $DEST_FOLDER)" ]; then fn_log_info "Safety check failed - the destination does not appear to be a backup folder or drive (marker file not found)." fn_log_info "If it is indeed a backup folder, you may add the marker file by running the following command:" fn_log_info "" |
