26 lines
799 B
Bash
Executable File
26 lines
799 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
output_dir=${1:-"$repo_root/reassembled"}
|
|
|
|
mkdir -p "$output_dir"
|
|
|
|
find "$repo_root/archives" -mindepth 1 -maxdepth 1 -type d -name '*.parts' -print | sort |
|
|
while IFS= read -r parts_dir; do
|
|
archive_name=$(basename "$parts_dir" .parts)
|
|
destination="$output_dir/$archive_name"
|
|
echo "Reassembling $archive_name"
|
|
find "$parts_dir" -type f -name 'part-*' -print | sort | xargs cat > "$destination"
|
|
done
|
|
|
|
for archive in "$repo_root"/archives/*; do
|
|
if [ -f "$archive" ]; then
|
|
archive_name=$(basename "$archive")
|
|
[ -e "$output_dir/$archive_name" ] || ln -s "$archive" "$output_dir/$archive_name"
|
|
fi
|
|
done
|
|
|
|
(cd "$output_dir" && shasum -a 256 -c "$repo_root/checksums/main-archives.sha256")
|
|
|