mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 06:17:03 -04:00
Use updated version of star database.
The star database file hygdata_v3.csv has been updated. Updated the expected checksum for it. Reworked the downloader to check for checksum disagreement. If checksum doesn't match, delete the file and download, then try the checksum again. This change will automatically fix obsolete files that have already been downloaded on contributor's development systems.
This commit is contained in:
@@ -1 +1 @@
|
||||
039fdcdcfc31968c6938863ac1d293854ba810bbfa0bcd72b1f4cc2d544f3d08 hygdata_v3.csv
|
||||
d5143f952a3f167ac9178947b729a26495ed796fe6b06f45a89e5c53d55106dc hygdata_v3.csv
|
||||
|
||||
61
generate/run
61
generate/run
@@ -20,37 +20,48 @@ Download()
|
||||
if [[ ! -f ${EPHFILE} ]]; then
|
||||
echo ""
|
||||
echo "Local file not found: ${EPHFILE}"
|
||||
echo "Trying to download for you from:"
|
||||
echo "${EPHURL}"
|
||||
elif ! ./checksum.py sha256 ${SHAFILE}; then
|
||||
# Sometimes we have to upgrade to a new version an external file.
|
||||
# When that happens, we just change the checksum file.
|
||||
# Then we notice here that the checksum doesn't match,
|
||||
# delete the file, and re-download it.
|
||||
echo ""
|
||||
if IsInstalled wget; then
|
||||
wget_success=false
|
||||
for attempt in {1..10}; do
|
||||
if [[ ${attempt} > 1 ]]; then
|
||||
echo "wget failed (attempt ${attempt} of 10) -- will retry download in 9 seconds..."
|
||||
sleep 9
|
||||
fi
|
||||
if wget --no-verbose ${EPHURL}; then
|
||||
echo "wget successfully downloaded the file."
|
||||
wget_success=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ ${wget_success} == true ]] || Fail "Could not download using wget: ${EPHFILE}"
|
||||
elif IsInstalled curl; then
|
||||
curl -L -o ${EPHFILE} ${EPHURL} || Fail "Could not download using curl: ${EPHFILE}"
|
||||
else
|
||||
echo "Neither wget nor curl is installed. Use your browser to download"
|
||||
echo "the file at the URL above into this directory."
|
||||
echo "Then run this script again to continue."
|
||||
exit 1
|
||||
fi
|
||||
echo "The local version of ${EPHFILE} is obsolete or corrupt."
|
||||
rm -fv ${EPHFILE}
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Attempting download from:"
|
||||
echo "${EPHURL}"
|
||||
echo ""
|
||||
if IsInstalled wget; then
|
||||
wget_success=false
|
||||
for attempt in {1..10}; do
|
||||
if [[ ${attempt} > 1 ]]; then
|
||||
echo "wget failed (attempt ${attempt} of 10) -- will retry download in 9 seconds..."
|
||||
sleep 9
|
||||
fi
|
||||
if wget --no-verbose ${EPHURL}; then
|
||||
echo "wget successfully downloaded the file."
|
||||
wget_success=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ ${wget_success} == true ]] || Fail "Could not download using wget: ${EPHFILE}"
|
||||
elif IsInstalled curl; then
|
||||
curl -L -o ${EPHFILE} ${EPHURL} || Fail "Could not download using curl: ${EPHFILE}"
|
||||
else
|
||||
echo "Neither wget nor curl is installed. Use your browser to download"
|
||||
echo "the file at the URL above into this directory."
|
||||
echo "Then run this script again to continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ./checksum.py sha256 ${SHAFILE}; then
|
||||
echo "Validated file using sha256 checksum."
|
||||
else
|
||||
rm -f ${EPHFILE}
|
||||
rm -fv ${EPHFILE}
|
||||
Fail "Detected corrupt file: failed sha256 check."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -249,33 +249,44 @@ REM A special download process helps keep the repo size reasonable for most
|
||||
set EPHURL=%1
|
||||
set EPHFILE=%2
|
||||
set SHAFILE=%3
|
||||
|
||||
if not exist !EPHFILE! (
|
||||
echo.
|
||||
echo.Local file not found: !EPHFILE!
|
||||
echo.Trying to download for you from:
|
||||
echo.!EPHURL!
|
||||
) else (
|
||||
py checksum.py sha256 !SHAFILE! && exit /b 0
|
||||
REM Sometimes we have to upgrade to a new version an external file.
|
||||
REM When that happens, we just change the checksum file.
|
||||
REM Then we notice here that the checksum doesn't match,
|
||||
REM delete the file, and re-download it.
|
||||
echo.
|
||||
|
||||
if defined wgetexe (
|
||||
echo.Trying download using !wgetexe! ...
|
||||
"!wgetexe!" !EPHURL! && goto verify_eph
|
||||
)
|
||||
|
||||
if defined curlexe (
|
||||
echo.Trying download using !curlexe! ...
|
||||
"!curlexe!" -L -o !EPHFILE! !EPHURL! && goto verify_eph
|
||||
)
|
||||
|
||||
if exist !EPHFILE! (del !EPHFILE!)
|
||||
|
||||
echo.
|
||||
echo.Could not download the file.
|
||||
echo.Use your browser to download the above file from
|
||||
echo.the above URL into this directory.
|
||||
echo.Then run this batch file again to continue.
|
||||
exit /b 1
|
||||
echo.The local version of !EPHFILE! is obsolete or corrupt.
|
||||
del !EPHFILE!
|
||||
)
|
||||
|
||||
echo.Attempting download from:
|
||||
echo.!EPHURL!
|
||||
echo.
|
||||
|
||||
if defined wgetexe (
|
||||
echo.Trying download using !wgetexe! ...
|
||||
"!wgetexe!" !EPHURL! && goto verify_eph
|
||||
)
|
||||
|
||||
if defined curlexe (
|
||||
echo.Trying download using !curlexe! ...
|
||||
"!curlexe!" -L -o !EPHFILE! !EPHURL! && goto verify_eph
|
||||
)
|
||||
|
||||
if exist !EPHFILE! (del !EPHFILE!)
|
||||
|
||||
echo.
|
||||
echo.Could not download the file.
|
||||
echo.Use your browser to download the above file from
|
||||
echo.the above URL into this directory.
|
||||
echo.Then run this batch file again to continue.
|
||||
exit /b 1
|
||||
|
||||
:verify_eph
|
||||
echo.Verifying integrity of file: !EPHFILE!
|
||||
py checksum.py sha256 !SHAFILE! || (
|
||||
|
||||
Reference in New Issue
Block a user