mirror of
https://github.com/laurent22/rsync-time-backup
synced 2024-12-15 22:52:34 +00:00
Simplify fn_is_backup_destination implementation.
This commit is contained in:
parent
4250423d98
commit
855c77a83f
1 changed files with 3 additions and 8 deletions
|
@ -43,7 +43,7 @@ fn_find_backups() {
|
||||||
fn_expire_backup() {
|
fn_expire_backup() {
|
||||||
# Double-check that we're on a backup destination to be completely
|
# Double-check that we're on a backup destination to be completely
|
||||||
# sure we're deleting the right folder
|
# 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."
|
fn_log_error "$1 is not on a backup destination - aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -78,15 +78,10 @@ fn_backup_marker_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_is_backup_destination() {
|
fn_is_backup_destination() {
|
||||||
DEST_MARKER_FILE="$(fn_backup_marker_path $1)"
|
find "$(fn_backup_marker_path "$1")" 2>/dev/null
|
||||||
if [ -f "$DEST_MARKER_FILE" ]; then
|
|
||||||
echo "1"
|
|
||||||
else
|
|
||||||
echo "0"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 "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 "If it is indeed a backup folder, you may add the marker file by running the following command:"
|
||||||
fn_log_info ""
|
fn_log_info ""
|
||||||
|
|
Loading…
Reference in a new issue