fix(backup): read remote backup list from stdin in selector
select_newest_remote_backup_from_list was sorting an empty process substitution instead of the piped list-backups.sh output. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,9 +66,20 @@ select_newest_remote_backup_from_list() {
|
||||
local remote_source=$1
|
||||
local volume_name=$2
|
||||
local newest="" f size
|
||||
local -a files=()
|
||||
|
||||
while IFS= read -r f; do
|
||||
[[ -z "$f" ]] && continue
|
||||
[[ -n "$f" ]] && files+=("$f")
|
||||
done
|
||||
|
||||
if (( ${#files[@]} == 0 )); then
|
||||
return 0
|
||||
fi
|
||||
|
||||
IFS=$'\n' files=( $(printf '%s\n' "${files[@]}" | sort) )
|
||||
unset IFS
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
[[ "$f" == "${volume_name}-"* ]] || continue
|
||||
[[ "$f" == *.tar.zst ]] || continue
|
||||
size=$(remote_backup_archive_size_bytes "$remote_source" "$f")
|
||||
@@ -77,7 +88,7 @@ select_newest_remote_backup_from_list() {
|
||||
continue
|
||||
fi
|
||||
newest="$f"
|
||||
done < <(sort)
|
||||
done
|
||||
|
||||
if [[ -n "$newest" ]]; then
|
||||
echo "$newest"
|
||||
|
||||
Reference in New Issue
Block a user