Commit fdc1a00c authored by Sam Stephenson's avatar Sam Stephenson
Browse files

Degrade gracefully (no checksumming or mirrors) if MD5 is unavailable

parent 1043ab60
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -138,12 +138,15 @@ compute_md5() {
    local output="$(md5sum -b)"
    echo "${output% *}"
  else
    echo "error: please install \`md5sum\` and try again" >&2
    exit 1
    return 1
  fi
}

verify_checksum() {
  if [ -z "$HAS_MD5_SUPPORT" ]; then
    return 0
  fi

  local filename="$1"
  if [ ! -e "$filename" ]; then
    return 1
@@ -591,6 +594,13 @@ if [ -n "$RUBY_BUILD_SKIP_MIRROR" ]; then
  unset RUBY_BUILD_MIRROR_URL
fi

if echo test | compute_md5 >/dev/null; then
  HAS_MD5_SUPPORT=1
else
  unset HAS_MD5_SUPPORT
  unset RUBY_BUILD_MIRROR_URL
fi

SEED="$(date "+%Y%m%d%H%M%S").$$"
LOG_PATH="${TMP}/ruby-build.${SEED}.log"
RUBY_BIN="${PREFIX_PATH}/bin/ruby"