From 5b1c7942c346cf0890ec6ba6a9b8f527074f39a5 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 1 May 2023 07:42:51 -0300 Subject: bin/backup: Verify data by default from now on --- bin/backup | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/backup b/bin/backup index 2c23a98..9826fd4 100755 --- a/bin/backup +++ b/bin/backup @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - backup [-q] [-C COMMENT] [ARCHIVE_TAG] + backup [-q] [-C COMMENT] [-x] [ARCHIVE_TAG] backup -h EOF } @@ -17,6 +17,7 @@ help() { -q disable verbose mode, useful for non-interactive sessions -C COMMENT the comment text to be attached to the archive + -x disable checking the repository after creating the backup -h, --help show this message ARCHIVE_TAG the tag used to create the new @@ -44,9 +45,10 @@ help() { $ backup - Create backup with comment, and verbose mode active: + Create backup with comment, and verbose mode active, and do not + verify the repository afterwards: - $ backup -qC 'The backup has a comment' my-backup + $ backup -qxC 'The backup has a comment' my-backup EOF } @@ -67,7 +69,8 @@ done VERBOSE_FLAGS='--verbose --progress' COMMENT='' -while getopts 'qC:h' flag; do +CHECK=true +while getopts 'qC:xh' flag; do case "$flag" in q) VERBOSE_FLAGS='' @@ -75,6 +78,9 @@ while getopts 'qC:h' flag; do C) COMMENT="$OPTARG" ;; + x) + CHECK=false + ;; h) usage help @@ -118,4 +124,9 @@ run() { fi } -run || exit $? +run + +if [ "$CHECK" = true ]; then + # shellcheck disable=2086 + borg check $VERBOSE_FLAGS --verify-data +fi -- cgit v1.2.3