31 lines
693 B
Bash
Executable File
31 lines
693 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
# Reassemble a Git-LFS split Pi backup after `git lfs pull`.
|
|
# Usage: ./assemble-pi-backup.sh [backup-base-name]
|
|
|
|
base=${1:-pi-backup-20260714-002452.tar.zst}
|
|
shopt -s nullglob
|
|
parts=("${base}".part-*)
|
|
|
|
(( ${#parts[@]} > 0 )) || {
|
|
printf 'No archive parts found for %s\n' "$base" >&2
|
|
exit 1
|
|
}
|
|
|
|
for command in cat sha256sum; do
|
|
command -v "$command" >/dev/null || {
|
|
printf 'Required command is unavailable: %s\n' "$command" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
cat "${parts[@]}" > "$base"
|
|
printf 'Created: %s\n' "$base"
|
|
|
|
if [[ -f "${base}.sha256" ]]; then
|
|
sha256sum -c "${base}.sha256"
|
|
else
|
|
printf 'Checksum file not found: %s.sha256\n' "$base" >&2
|
|
fi
|