scripts/fetch in rvm-0.1.41 vs scripts/fetch in rvm-0.1.42

- old
+ new

@@ -1,10 +1,17 @@ #!/usr/bin/env bash rvm_base_except="selector" source "$rvm_scripts_path/base" +# Set it to cleanup the download on interruption. +trap 'cleanup_download' 1 2 3 15 + +cleanup_download() { + [[ -f "$archive" ]] && rm -rf "$archive" +} + record_md5() { if [[ "Darwin" = "$(uname)" ]] || [[ "FreeBSD" = "$(uname)" ]]; then archive_md5="$(/sbin/md5 -q "${archive}")" else archive_md5="$(md5sum "${archive}" | awk '{print $1}')" @@ -36,11 +43,11 @@ fi if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Fetching $archive" ; fi # Check first if we have the correct archive -archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive")" +archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive" | head -n1)" if [[ -e "$archive" ]] && [[ ! -z "$archive_md5" ]] ; then if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Found archive and its md5, testing correctness" ; fi if ! $rvm_scripts_path/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Archive is bad, downloading" ; fi download=1 @@ -85,7 +92,6 @@ fi else record_md5 fi fi - exit $result