aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-05-09 09:15:49 -0300
committerEuAndreh <eu@euandre.org>2024-05-09 09:15:49 -0300
commit4f34c8314d46ff86ff1199ab719bee187ade8c3b (patch)
treebcd2b1f6f09221199d4407e8740e62e16b425a7e
parentetc/guix/home.scm: Include "static" and "debug" outputs of "gcc-toolchain" pa... (diff)
downloaddotfiles-4f34c8314d46ff86ff1199ab719bee187ade8c3b.tar.gz
dotfiles-4f34c8314d46ff86ff1199ab719bee187ade8c3b.tar.xz
bin/backup: Further simplify this backup script
-rwxr-xr-xbin/backup44
1 files changed, 7 insertions, 37 deletions
diff --git a/bin/backup b/bin/backup
index 2fc85cd..44e2cd0 100755
--- a/bin/backup
+++ b/bin/backup
@@ -4,8 +4,7 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- backup [-q] [-C COMMENT] [-x] [ARCHIVE_TAG]
- backup -h
+ backup [-q] [ARCHIVE_TAG]
EOF
}
@@ -16,11 +15,9 @@ help() {
Options:
-q disable verbose mode, useful for
non-interactive sessions
- -C COMMENT the comment text to be attached to the archive
- -h, --help show this message
ARCHIVE_TAG the tag used to create the new
- backup (default: "manual")
+ backup (default: "default")
The repository is expected to have been created with:
@@ -46,40 +43,16 @@ help() {
Create backup with comment, and verbose mode active:
- $ backup -qC 'The backup has a comment' my-backup
+ $ backup -q my-backup
EOF
}
-for flag in "$@"; do
- case "$flag" in
- (--)
- break
- ;;
- (--help)
- usage
- help
- exit
- ;;
- (*)
- ;;
- esac
-done
-
VERBOSE_FLAGS='--verbose --progress'
-COMMENT=''
-while getopts 'qC:h' flag; do
+while getopts 'q' flag; do
case "$flag" in
(q)
VERBOSE_FLAGS=''
;;
- C)
- COMMENT="$OPTARG"
- ;;
- (h)
- usage
- help
- exit
- ;;
(*)
usage >&2
exit 2
@@ -89,14 +62,11 @@ done
shift $((OPTIND - 1))
-ARCHIVE_TAG="${1:-manual}"
+TAG="${1:-default}"
+ARCHIVE="::{hostname}-{user}-{now}-$TAG"
set -x
# The contents of $VERBOSE_FLAGS doesn't involve user input:
# shellcheck disable=2086
-borgy \
- $VERBOSE_FLAGS \
- --comment "$COMMENT" \
- "::{hostname}-{now}-$ARCHIVE_TAG" \
- ~/
+borgy $VERBOSE_FLAGS "$ARCHIVE" ~/