summaryrefslogtreecommitdiff
path: root/backomp
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-07-29 11:42:42 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-07-29 11:43:17 -0700
commit27d127a861ae9707473b2eaf77bb39fe5350fd8e (patch)
tree6d5ba80819c8c40ddbc5c4c1e711e6693369f4d9 /backomp
parent043f719486b940d403bcdb72defb5ed401cb5252 (diff)
downloadbackomp-27d127a861ae9707473b2eaf77bb39fe5350fd8e.tar.gz
backomp-27d127a861ae9707473b2eaf77bb39fe5350fd8e.tar.xz
allow empty retain setting to keep all backups
Diffstat (limited to 'backomp')
-rwxr-xr-xbackomp9
1 files changed, 5 insertions, 4 deletions
diff --git a/backomp b/backomp
index c811a2a..f955916 100755
--- a/backomp
+++ b/backomp
@@ -42,11 +42,11 @@ BEGIN {
wshift = (11 - arr2[opt_week_start])*24*60*60
}
-NR == 1 {
+!n_buckets || NR == 1 {
++keep[$0]
}
-{
+n_buckets {
t = mktime(gensub(/(.*\/|^)(.+)-(..)-(..)-(..)(..)(..)$/,
"\\2 \\3 \\4 \\5 \\6 \\7", 1), 1)
if (t < 0) {
@@ -354,7 +354,7 @@ backup() {
dest_path="${dest_dir}/$(date -u '+%Y-%m-%d-%H%M%S')"
copy "${src_path}" "${dest_path}" "${snaps[0]}" || return 1
- if [[ ! "${retain}" =~ ^( *([0-9]+|\*)\^?[hdwM] *)+$ ]]; then
+ if [[ ! "${retain}" =~ ^( *([0-9]+|\*)\^?[hdwM])*\ *$ ]]; then
err "invalid \$retain setting: ${retain}"
return 1
fi
@@ -369,13 +369,14 @@ backup() {
}
declare -A def_opts=(
- ['retain']='*h' # e.g. 24h7d4w12M or 24^h10d*M
+ ['retain']= # e.g. *h or 24h7d4w12M or 24^h10d*M
['interval']='0'
['week_start']='mon'
['rsync_flags']='-a'
['rclone_flags']='--sftp-copy-is-hardlink'
['rclone_copy_command']='copy'
['rclone_use_copy_dest']=1
+ ['pre_copy']=
)
declare -A opts tainted_opts
reset_opts() {