(run) Download to a temporary file to avoid corruption from aborted downloads

This commit is contained in:
Viktor Lofgren 2023-12-18 18:28:17 +01:00
parent 62954f98de
commit 128f550ee5
2 changed files with 3 additions and 2 deletions

View File

@ -42,7 +42,7 @@ fi
mkdir -p node-1/samples/
SAMPLE_TARBALL=samples/${SAMPLE_NAME}.tar.gz
download_model ${SAMPLE_TARBALL} https://downloads.marginalia.nu/${SAMPLE_TARBALL}
download_model ${SAMPLE_TARBALL}.tmp https://downloads.marginalia.nu/${SAMPLE_TARBALL} && mv ${SAMPLE_TARBALL}.tmp ${SAMPLE_TARBALL}
if [ ! -f ${SAMPLE_TARBALL} ]; then
echo "!! Failed"

View File

@ -12,7 +12,8 @@ function download_model {
if [ ! -f $model ]; then
echo "** Downloading $url"
curl -s -o $model $url
curl -s -o $model.tmp $url
mv $model.tmp $model
fi
}