Small borg-wrapper refactor, now uses push/pop directory changes to back up only the basename
This commit is contained in:
parent
d664549b8a
commit
1a87b3af47
1 changed files with 5 additions and 4 deletions
|
@ -19,9 +19,6 @@ let
|
||||||
borg-wrapper = pkgs.writeScript "borg-wrapper" ''
|
borg-wrapper = pkgs.writeScript "borg-wrapper" ''
|
||||||
#!${lib.getExe pkgs.fish}
|
#!${lib.getExe pkgs.fish}
|
||||||
|
|
||||||
# Enable strict error handling
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
set -l CMD
|
set -l CMD
|
||||||
|
|
||||||
|
@ -59,10 +56,14 @@ let
|
||||||
set -l tag $argv[1]
|
set -l tag $argv[1]
|
||||||
set -l timestamp (date +%Y%m%d-%H%M%S)
|
set -l timestamp (date +%Y%m%d-%H%M%S)
|
||||||
echo "Creating $tag backup: $timestamp"
|
echo "Creating $tag backup: $timestamp"
|
||||||
|
|
||||||
|
# Push to parent directory, backup the basename only, then pop back
|
||||||
|
pushd (dirname "$BACKUP_PATH") >/dev/null
|
||||||
${pkgs.borgbackup}/bin/borg create --stats --compression zstd,15 \
|
${pkgs.borgbackup}/bin/borg create --stats --compression zstd,15 \
|
||||||
--files-cache=mtime,size \
|
--files-cache=mtime,size \
|
||||||
--lock-wait 5 \
|
--lock-wait 5 \
|
||||||
"$BORG_REPO::$tag-$timestamp" "$BACKUP_PATH" || true
|
"$BORG_REPO::$tag-$timestamp" (basename "$BACKUP_PATH") || true
|
||||||
|
popd >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
function prune_backups
|
function prune_backups
|
||||||
|
|
Loading…
Add table
Reference in a new issue