Permalink
Browse files

add --verify-download

  • Loading branch information...
1 parent a9f6b6d commit 24ea3768aaa9c8a89c6474c0a21a7b793c736c4b @mpapis mpapis committed Aug 24, 2012
Showing with 45 additions and 24 deletions.
  1. +11 −3 help/fetch
  2. +17 −9 help/install
  3. +1 −1 scripts/cli
  4. +12 −7 scripts/fetch
  5. +2 −2 scripts/functions/checksum
  6. +2 −2 scripts/functions/environment
View
@@ -1,5 +1,13 @@
-Fetch
+# Fetch
- Performs an archive / src fetch of the current selected ruby.
+Performs an archive / src fetch of the current selected ruby.
-Usage: ∴ rvm fetch
+## Usage
+
+ ∴ rvm fetch [--verify-download {0,1,2}]
+
+Where `--verify-download {0,1,2}` specifies verification level:
+
+- `0` - only verified allowed - the default,
+- `1` - allow missing checksum,
+- `2` - allow failed checksum.
View
@@ -1,29 +1,37 @@
+## Usage
-Usage
-
- rvm install [ruby-string]
+ rvm install [ruby-string] [--verify-download {0,1,2}]
For a partial list of valid ruby strings please run
- rvm list known
+ rvm list known
For MRI Rubies you may pass configuration parameters in one of two ways:
- rvm install 1.9.2 --with-iconv-dir=$HOME/.rvm --without-readline
+ rvm install 1.9.2 --with-iconv-dir=$HOME/.rvm --without-readline
and/or
- rvm install 1.9.2 -C --with-iconv-dir=$HOME/.rvm,--without-readline
+ rvm install 1.9.2 -C --with-iconv-dir=$HOME/.rvm,--without-readline
To do dirty installation using the same sources use:
- rvm install --force 1.9.2
+ rvm install --force 1.9.2
To do clean installation use:
- rvm reinstall 1.9.2
+ rvm reinstall 1.9.2
+
+
+## Veryfication
+
+`--verify-download {0,1,2}` specifies verification level:
+
+- `0` - only verified allowed,
+- `1` - allow missing checksum,
+- `2` - allow failed checksum.
Please see the documentation for further information:
- https://rvm.io/rubies/installing/
+- https://rvm.io/rubies/installing/
View
@@ -681,7 +681,7 @@ __rvm_parse_args()
export "rvm_${rvm_token}_flag"=1
;;
- --dump-environment)
+ --dump-environment|--verify-downloads)
rvm_token=${rvm_token#--}
rvm_token=${rvm_token//-/_}
export "rvm_${rvm_token}_flag"="$next_token"
View
@@ -100,18 +100,23 @@ fi
# Check if we have downloaded the correct archive
if
- __rvm_checksum_any
+ __rvm_checksum_validate_file "$rvm_archives_path/${archive}"
then
+ rvm_debug "Downloaded archive checksum matched."
+else
+ result=$?
if
- __rvm_checksum_validate_file "$rvm_archives_path/${archive}"
+ (( result==1 && ${rvm_verify_downloads_flag:-0}==1 ))
then
- rvm_debug "Downloaded archive checksum matched."
+ rvm_warn "No checksum for downloaded archive, recording checksum in user configuration."
+ __rvm_checksum_calculate_file "$archive"
+ __rvm_checksum_write "$archive"
+ elif
+ (( result>1 && ${rvm_verify_downloads_flag:-0}>1 ))
+ then
+ rvm_warn "Downloaded archive checksum did not match!"
else
rm -f $archive
rvm_fail "Downloaded archive checksum did not match, removing!"
fi
-else
- rvm_debug "No checksum, recording."
- __rvm_checksum_calculate_file "$archive"
- __rvm_checksum_write "$archive"
fi
@@ -80,12 +80,12 @@ __rvm_checksum_validate_file()
if
[[ -n "${_checksum_md5:-}" ]]
then
- [[ "$(__rvm_md5_calculate "${1:-}")" == "${_checksum_md5:-}" ]] || return $?
+ [[ "$(__rvm_md5_calculate "${1:-}")" == "${_checksum_md5:-}" ]] || return 2
fi
if
[[ -n "${_checksum_sha512:-}" ]]
then
- [[ "$(__rvm_sha__calculate 512 "${1:-}")" == "${_checksum_sha512:-}" ]] || return $?
+ [[ "$(__rvm_sha__calculate 512 "${1:-}")" == "${_checksum_sha512:-}" ]] || return 3
fi
return 0
}
@@ -225,7 +225,7 @@ __rvm_run_with_env()
__rvm_setup()
{
# NOTE: the same set is located below - maker kjfdngkjd
- export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag
+ export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
export rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
export rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
export __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems
@@ -306,7 +306,7 @@ __rvm_teardown()
# a corrupt PATH, breaking the RVM installation.
#
# NOTE: the same set is located above - maker kjfdngkjd
- unset rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag
+ unset rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
unset rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
unset rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
unset __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems

0 comments on commit 24ea376

Please sign in to comment.