Fix dry-run not working with --stats

dev
hk 2019-09-24 14:46:39 +02:00
parent 8035d70fa6
commit 9d2c564ba2
1 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
VERSION="1.5.1" VERSION="1.5.2"
print_usage () { print_usage () {
@ -50,14 +50,18 @@ borg_backup () {
if [[ -z ${BORG_CREATE_ARGS[@]} ]]; then if [[ -z ${BORG_CREATE_ARGS[@]} ]]; then
BORG_CREATE_ARGS=( BORG_CREATE_ARGS=(
--info --info
--stats
--list --list
--filter AME --filter AME
--compression lz4 --compression lz4
) )
fi 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 \
"${BORG_CREATE_ARGS[@]}" \ "${BORG_CREATE_ARGS[@]}" \
"${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \ "${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \
@ -69,12 +73,16 @@ borg_prune () {
if [[ -z ${BORG_PRUNE_ARGS[@]} ]]; then if [[ -z ${BORG_PRUNE_ARGS[@]} ]]; then
BORG_PRUNE_ARGS=( BORG_PRUNE_ARGS=(
--info --info
--stats
--list --list
) )
fi 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 \
"${BORG_PRUNE_ARGS[@]}" \ "${BORG_PRUNE_ARGS[@]}" \
--prefix "{hostname}-" \ --prefix "{hostname}-" \