Adapt update script to avoid downloading again and reuse release files

This commit is contained in:
Benoit Daloze 2019-04-20 01:50:07 +09:00
parent ec4259c0fd
commit a0b37e8084

View file

@ -2,19 +2,20 @@
set -e
if [ $# -ne 1 ]; then
echo "usage: $0 VERSION"
if [ $# -ne 2 ]; then
echo "usage: $0 VERSION RELEASE_DIRECTORY"
exit 1
fi
version="$1"
release_directory="$2"
file="share/ruby-build/truffleruby-${version}"
add_platform() {
platform="$1"
basename="truffleruby-${version}-${platform}.tar.gz"
url="https://github.com/oracle/truffleruby/releases/download/vm-${version}/${basename}"
sha256=$(curl -L "$url" | sha256sum | cut -d ' ' -f 1)
sha256=$(sha256sum "$release_directory/$basename" | cut -d ' ' -f 1)
cat >> "$file" <<EOS
install_package "truffleruby-${version}" "${url}#${sha256}" truffleruby