From 9d2c564ba279d5476c9c47d49f20f67ab690d13b Mon Sep 17 00:00:00 2001 From: hk Date: Tue, 24 Sep 2019 14:46:39 +0200 Subject: [PATCH] Fix dry-run not working with --stats --- src/borgwrapper | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/borgwrapper b/src/borgwrapper index 4198f91..e33d18b 100755 --- a/src/borgwrapper +++ b/src/borgwrapper @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="1.5.1" +VERSION="1.5.2" print_usage () { @@ -50,14 +50,18 @@ borg_backup () { if [[ -z ${BORG_CREATE_ARGS[@]} ]]; then BORG_CREATE_ARGS=( --info - --stats --list --filter AME --compression lz4 ) fi - ${DRY_RUN} && BORG_CREATE_ARGS+=( --dry-run ) + if ${DRY_RUN}; then + BORG_CREATE_ARGS+=( --dry-run ) + else + BORG_CREATE_ARGS+=( --stats ) + fi + ${BORG} create \ "${BORG_CREATE_ARGS[@]}" \ "${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \ @@ -69,12 +73,16 @@ borg_prune () { if [[ -z ${BORG_PRUNE_ARGS[@]} ]]; then BORG_PRUNE_ARGS=( --info - --stats --list ) fi - ${DRY_RUN} && BORG_PRUNE_ARGS+=( --dry-run ) + if ${DRY_RUN}; then + BORG_PRUNE_ARGS+=( --dry-run ) + else + BORG_PRUNE_ARGS+=( --stats ) + fi + ${BORG} prune \ "${BORG_PRUNE_ARGS[@]}" \ --prefix "{hostname}-" \