diff --git a/README.md b/README.md index d36b421..4d57a22 100644 --- a/README.md +++ b/README.md @@ -371,8 +371,10 @@ If image pulls or snapshot downloads fail, make sure the host can reach: If `bedrock-init` exits with `Unexpected checksum file format`, `Checksum file does not match downloaded archive`, or `SHA256 verification -failed`, do not reuse that download. Retry later or verify the checksum -yourself before attempting another restore. +failed`, retry later: the next run downloads the snapshot again and replaces +the failed archive. Archives named like `snapshot.tar.1.zst`, left by runs +before this behaviour, stay in the `snapshot_downloads` volume until you remove +them (for example with `docker compose down -v`). ### Snapshot sources diff --git a/scripts/utils.sh b/scripts/utils.sh index fa5293c..eb2e1bf 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -31,13 +31,21 @@ function extractlz4() { # Arguments: # url: URL of the file to download. # out: Location to download the file to. +# +# A file left at `out` by an earlier failed run (for example after a checksum +# mismatch or an interrupted extraction) must be replaced, not kept: by default +# aria2c saves the new download as ".1." and the caller would go on +# to verify and extract the stale file. An unfinished download that still has +# its .aria2 control file is resumed as before. function download() { local out_dir out_name out_dir="$(dirname "$2")" out_name="$(basename "$2")" mkdir -p "$out_dir" - aria2c --max-tries=0 -x 16 -s 16 -k100M --dir="$out_dir" --out="$out_name" "$1" + aria2c --max-tries=0 -x 16 -s 16 -k100M \ + --allow-overwrite=true --auto-file-renaming=false \ + --dir="$out_dir" --out="$out_name" "$1" } # verify_sha256_checksum: Verifies a downloaded file against a checksum file.