aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-05-01 07:42:51 -0300
committerEuAndreh <eu@euandre.org>2023-05-01 07:42:51 -0300
commit5b1c7942c346cf0890ec6ba6a9b8f527074f39a5 (patch)
treedbfe3ac48a5e9320e34811779fb62948ccaa1212
parentetc/guix/system.scm: Increase Postfix size limits (diff)
downloaddotfiles-5b1c7942c346cf0890ec6ba6a9b8f527074f39a5.tar.gz
dotfiles-5b1c7942c346cf0890ec6ba6a9b8f527074f39a5.tar.xz
bin/backup: Verify data by default from now on
-rwxr-xr-xbin/backup21
1 files changed, 16 insertions, 5 deletions
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