nix/home/program/bash/module/Save.nix

24 lines
477 B
Nix
Raw Normal View History

2024-04-06 03:03:58 +03:00
{ ... }: {
text = ''
# Backup a game save.
# Usage: save [TARGETS]
function save() {
local IFS=$'\n'
local targets=("''${@}")
local files=()
[[ "''${targets}" = "" ]] && targets=($(_ls_dir))
_info "Archiving..."
for target in ''${targets[@]}; do
files+=($(archive "''${target}"))
done
_info "Uploading..."
2024-04-16 14:49:07 +03:00
try trysudo rcp "''${files[@]}" home:/storage/cold_1/backup/save/
2024-04-06 03:03:58 +03:00
_info "Cleaning..."
archive_prune 2> /dev/null
}
'';
}