summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2026-01-12 21:11:30 -0300
committerEuAndreh <eu@euandre.org>2026-01-12 21:11:30 -0300
commit1253ffac4984e49b1f7d0c5137099354d5bc9983 (patch)
tree01fcc74af90cee2b80c8fdb53ad82bf3611faa72
parentsrc/borgy: Stick to default xz compression level 6 (diff)
downloadbackupit-1253ffac4984e49b1f7d0c5137099354d5bc9983.tar.gz
backupit-1253ffac4984e49b1f7d0c5137099354d5bc9983.tar.xz
src/backupit: Fix handling of dirs file
-rwxr-xr-xsrc/backupit22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/backupit b/src/backupit
index ec99c32..e4dcd87 100755
--- a/src/backupit
+++ b/src/backupit
@@ -9,11 +9,15 @@ usage() {
}
VERBOSE_FLAGS='--verbose --progress'
-while getopts 'q' flag; do
+TAG=default
+while getopts 'qt:' flag; do
case "$flag" in
(q)
VERBOSE_FLAGS=''
;;
+ (t)
+ TAG="$OPTARG"
+ ;;
(*)
usage >&2
exit 2
@@ -23,21 +27,22 @@ done
shift $((OPTIND - 1))
-TAG="${1:-default}"
ARCHIVE="::{hostname}-{user}-{now}-$TAG"
-
-
-
xdg="${XDG_CONFIG_HOME:-$HOME/.config}"/backupit.txt
global=/etc/backupit.txt
f() {
+ if [ $# != 0 ]; then
+ printf '%s\n' "$@"
+ return
+ fi
+
if [ -e "$xdg" ]; then
- printf '%s' "$xdg"
+ cat "$xdg"
return
fi
if [ -e "$global" ]; then
- printf '%s' "$global"
+ cat "$global"
return
fi
@@ -47,5 +52,4 @@ f() {
exit 2
}
-F="$(f)"
-exec borgy $VERBOSE_FLAGS "$ARCHIVE" $(cat "$F")
+exec borgy $VERBOSE_FLAGS "$ARCHIVE" $(f "$@")