2020-03-09 19:57:18 +09:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
set -o pipefail
|
|
|
|
|
|
2024-08-01 18:42:38 +09:00
|
|
|
if [ $# -ne 3 ]; then
|
|
|
|
|
echo "usage: $0 VERSION OPENSSL_VERSION RELEASE_DIRECTORY"
|
2020-03-09 19:57:18 +09:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
version="$1"
|
2024-08-01 18:42:38 +09:00
|
|
|
openssl_version="$2"
|
|
|
|
|
release_directory="$3"
|
2020-03-09 19:57:18 +09:00
|
|
|
file="share/ruby-build/${version}"
|
|
|
|
|
|
2021-11-09 19:22:19 +09:00
|
|
|
basename="ruby-${version}.tar.gz"
|
2024-08-01 18:42:38 +09:00
|
|
|
openssl_basename="openssl-${openssl_version}.tar.gz"
|
2020-03-09 19:57:18 +09:00
|
|
|
major_minor_version=$(echo ${version} | cut -d '.' -f 1,2)
|
|
|
|
|
url="https://cache.ruby-lang.org/pub/ruby/${major_minor_version}/${basename}"
|
2023-03-30 16:18:59 -04:00
|
|
|
if command -v sha256sum >/dev/null; then
|
|
|
|
|
sha256=$(sha256sum "$release_directory/$basename" | cut -d ' ' -f 1)
|
|
|
|
|
elif command -v shasum >/dev/null; then
|
|
|
|
|
sha256=$(shasum -a 256 "$release_directory/$basename" | cut -d ' ' -f 1)
|
|
|
|
|
else
|
|
|
|
|
echo "$0 requires sha256sum or shasum to be installed on the system."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-03-09 19:57:18 +09:00
|
|
|
|
2024-09-04 10:45:31 +09:00
|
|
|
openssl_url="https://github.com/openssl/openssl/releases/download/openssl-${openssl_version}/openssl-${openssl_version}.tar.gz"
|
2024-08-01 18:42:38 +09:00
|
|
|
if command -v sha256sum >/dev/null; then
|
|
|
|
|
openssl_sha256=$(sha256sum "$release_directory/$openssl_basename" | cut -d ' ' -f 1)
|
|
|
|
|
elif command -v shasum >/dev/null; then
|
|
|
|
|
openssl_sha256=$(shasum -a 256 "$release_directory/$openssl_basename" | cut -d ' ' -f 1)
|
|
|
|
|
else
|
|
|
|
|
echo "$0 requires sha256sum or shasum to be installed on the system."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-03-26 12:38:50 +09:00
|
|
|
major_version=$(echo ${version} | cut -d '.' -f 1)
|
|
|
|
|
if [ "$major_version" -ge 4 ]; then
|
|
|
|
|
needs_openssl="needs_openssl:1.1.1-3.x.x"
|
|
|
|
|
else
|
|
|
|
|
needs_openssl="needs_openssl:1.0.2-3.x.x"
|
|
|
|
|
fi
|
|
|
|
|
|
2020-03-09 19:57:18 +09:00
|
|
|
cat > "$file" <<EOS
|
2026-03-26 12:38:50 +09:00
|
|
|
install_package "openssl-${openssl_version}" "${openssl_url}#${openssl_sha256}" openssl --if ${needs_openssl}
|
2023-11-07 12:22:05 +01:00
|
|
|
install_package "ruby-${version}" "${url}#${sha256}" enable_shared standard
|
2020-03-09 19:57:18 +09:00
|
|
|
EOS
|