- curl -f will report an error code if the source reports 404 which
happens if the mirror doesn't contain the file. Otherwise we are left
with an invalid file.
- curl -L will follow redirects (302), which sourceforge uses sometimes.
Before we downloaded an invalid file (html page).
- verify_archive will no longer accept empty files as valid
if [ ! -e ${ARCHIVE_FILE} ]; then
return 2
fi
+
+ # empty file?
+ if [ ! -s ${ARCHIVE_FILE} ]; then
+ return 2
+ fi
# Check CHECKSUM has been specified for the package
if [ -z "${CHECKSUM}" ]; then
# Download.
# If curl or wget is failing, continue this loop for trying an other mirror.
if [ ${DOWNLOADER} = "curl" ]; then
- curl -k -O ${url} || continue
+ curl -f -L -k -O ${url} || continue
elif [ ${DOWNLOADER} = "wget" ]; then
wget --no-check-certificate ${url} -O ${ARCHIVE_FILE} || continue
else
cecho ${BAD} "candi: Unknown downloader: ${DOWNLOADER}"
exit 1
fi
-
+
unset url
# Verify the download
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams