3
3
shopt -s extglob
4
4
set -o errtrace
5
5
set -o errexit
6
+ set -o pipefail
6
7
7
8
rvm_install_initialize ()
8
9
{
@@ -26,7 +27,9 @@ rvm_install_initialize()
26
27
27
28
log () { printf " %b\n" " $* " ; }
28
29
debug (){ [[ ${rvm_debug_flag:- 0} -eq 0 ]] || printf " %b\n" " $* " >&2 ; }
29
- fail () { log " \nERROR: $* \n" >&2 ; exit 1 ; }
30
+ warn () { log " WARN: $* " >&2 ; }
31
+ fail () { fail_with_code 1 " $* " ; }
32
+ fail_with_code () { code=" $1 " ; shift ; log " \nERROR: $* \n" >&2 ; exit " $code " ; }
30
33
31
34
rvm_install_commands_setup ()
32
35
{
@@ -256,9 +259,10 @@ fetch_version()
256
259
return 0
257
260
fi
258
261
done
262
+ fail_with_code 4 " Exhausted all sources trying to fetch version '$version ' of RVM!"
259
263
}
260
264
261
- # Returns a sorted list of all version tags from a repository
265
+ # Returns a sorted list of most recent tags from a repository
262
266
fetch_versions ()
263
267
{
264
268
typeset _account _domain _repo _url
@@ -267,7 +271,7 @@ fetch_versions()
267
271
_repo=$3
268
272
case ${_domain} in
269
273
(bitbucket.org)
270
- _url=https://${_domain} /api/1 .0/repositories/${_account} /${_repo} /branches- tags
274
+ _url=" https://api. ${_domain} /2 .0/repositories/${_account} /${_repo} /refs/ tags?sort=-name&pagelen=20 "
271
275
;;
272
276
(github.com)
273
277
_url=https://api.${_domain} /repos/${_account} /${_repo} /tags
@@ -277,8 +281,9 @@ fetch_versions()
277
281
_url=https://${_domain} /api/v3/repos/${_account} /${_repo} /tags
278
282
;;
279
283
esac
280
- __rvm_curl -s ${_url} |
281
- \a wk -v RS=' ,' -v FS=' "' ' $2=="name"{print $4}' |
284
+
285
+ { __rvm_curl -sS " ${_url} " || warn " ...the preceeding error with code $? occurred while fetching $_url " ; } |
286
+ \a wk -v RS=' ,|values":' -v FS=' "' ' $2=="name"&&$4!="rvm"{print $4}' |
282
287
sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
283
288
}
284
289
@@ -408,28 +413,22 @@ verify_package_pgp()
408
413
then
409
414
log " GPG verified '$1 '"
410
415
else
411
- typeset _ret=$?
412
- log " \
413
- Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. \
414
- Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
416
+ typeset _return=$?
415
417
418
+ log " \
416
419
GPG signature verification failed for '$1 ' - '$3 '! Try to install GPG v2 and then fetch the public key:
417
420
418
- ${SUDO_USER: +sudo } gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
421
+ ${SUDO_USER: +sudo }${rvm_gpg_command ##*/ } --keyserver hkp://keyserver.ubuntu.com -- recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
419
422
420
423
or if it fails:
421
424
422
425
command curl -sSL https://rvm.io/mpapis.asc | ${SUDO_USER: +sudo }${rvm_gpg_command##*/ } --import -
426
+ command curl -sSL https://rvm.io/pkuczynski.asc | ${SUDO_USER: +sudo }${rvm_gpg_command##*/ } --import -
423
427
424
- the key can be compared with:
425
-
426
- https://rvm.io/mpapis.asc
427
- https://keybase.io/mpapis
428
-
429
- NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade \
430
- or upgrade to newer version (if available) or use the second method described above.
428
+ In case of further problems with validation please refer to https://rvm.io/rvm/security
431
429
"
432
- exit $_ret
430
+
431
+ exit ${_return}
433
432
fi
434
433
}
435
434
@@ -832,7 +831,7 @@ and re-mount partition ${partition} without the noexec option."
832
831
833
832
rvm_install_select_and_get_version ()
834
833
{
835
- typeset _version_release
834
+ typeset dir _version_release _version
836
835
837
836
for dir in " $rvm_src_path " " $rvm_archives_path "
838
837
do
@@ -843,24 +842,27 @@ rvm_install_select_and_get_version()
843
842
case " ${version} " in
844
843
(head)
845
844
_version_release=" ${branch} "
846
- install_head sources[@] ${branch:- master} || exit $?
845
+ install_head sources[@] ${branch:- master}
847
846
;;
848
847
849
848
(latest)
850
- install_release sources[@] $( fetch_version sources[@]) || exit $?
849
+ _version=$( fetch_version sources[@])
850
+ install_release sources[@] " $_version "
851
851
;;
852
852
853
853
(latest-minor)
854
- version=" $( \c at " $rvm_path /VERSION" ) "
855
- install_release sources[@] $( fetch_version sources[@] ${version% .* } ) || exit $?
854
+ version=" $( < " $rvm_path /VERSION" ) "
855
+ _version=$( fetch_version sources[@] ${version% .* } )
856
+ install_release sources[@] " $_version "
856
857
;;
857
858
858
859
(latest-* )
859
- install_release sources[@] $( fetch_version sources[@] ${version# latest-} ) || exit $?
860
+ _version=$( fetch_version sources[@] ${version# latest-} )
861
+ install_release sources[@] " $_version "
860
862
;;
861
863
862
864
(+ ([[:digit:]]).+ ([[:digit:]]).+ ([[:digit:]])) # x.y.z
863
- install_release sources[@] ${version} || exit $?
865
+ install_release sources[@] ${version}
864
866
;;
865
867
866
868
(* )
@@ -893,7 +895,7 @@ rvm_install_ruby_and_gems()
893
895
__rvm_print_headline
894
896
895
897
for _ruby in ${install_rubies[@]}
896
- do command rvm " ${forwarded_flags[@]} " install ${_ruby} -j 2
898
+ do command rvm " ${forwarded_flags[@]} " install ${_ruby}
897
899
done
898
900
# set the first one as default, skip rest
899
901
for _ruby in ${install_rubies[@]}
0 commit comments