install in rvm-1.0.10 vs install in rvm-1.0.11

- old
+ new

@@ -1,8 +1,9 @@ #!/usr/bin/env bash -#set -u # Error on uninitialized variables. +set -o errtrace +export PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }' if [[ -z "$rvm_selfcontained" ]]; then if [[ "root" = "$(whoami)" ]] || [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then export rvm_selfcontained=0 else @@ -11,10 +12,11 @@ fi unset rvm_auto_flag install_source_path="$(dirname "$0" | sed 's#\/scripts$##')" + if [[ -d "$install_source_path/scripts" ]] && [[ -s "$install_source_path/scripts/utility" ]] ; then builtin cd "$install_source_path" fi source scripts/version @@ -32,25 +34,16 @@ --version : display rvm package version " } check_rubyopt_conditions() { - if [[ -n "$RUBYOPT" ]]; then + if [[ -n "${RUBYOPT:-""}" ]]; then printf "\n\nWARNING: You have RUBYOPT set in your current environment. This may interfere with normal rvm" printf "\n operation. If errors show up, please try unsetting RUBYOPT first.\n" fi } -# Regenerates a users wrappers as part of the update. -regenerate_wrappers() { - printf "\n" - if command -v __rvm_regenerate_wrappers >/dev/null; then - __rvm_regenerate_wrappers - fi - printf "\n" -} - andand_return_instructions() { printf " This means that if you see something like: '[ -z \"\$PS1\" ] && return' @@ -156,32 +149,43 @@ * If you wish to have the 'pretty colors' again, set in ~/.rvmrc: export rvm_pretty_print_flag=1 " } -if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi +set -o noclobber +set -o nounset while [[ $# -gt 0 ]] ; do token="$1" ; shift case "$token" in --auto) rvm_auto_flag=1 ;; --prefix) rvm_prefix="$1" ; shift ;; --version) rvm_path="$PWD" ; __rvm_version ; unset rvm_path ; exit ;; + --debug) + set -o verbose + ;; + --trace) + echo "$*" + env | grep '^rvm_' + set -o xtrace + ;; --help|*) usage ;; esac done -if [[ -z "$rvm_prefix" ]] ; then +if [[ -z "${rvm_prefix:-""}" ]] ; then __rvm_load_rvmrc if [[ "$rvm_selfcontained" = "0" ]] ; then rvm_prefix="${rvm_prefix:-"/usr/local/"}" else rvm_prefix="${rvm_prefix:-"$HOME/."}" fi fi -if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi +if [[ -z "${rvm_path:-""}" ]] ; then + rvm_path="${rvm_prefix}rvm" +fi source scripts/initialize if grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then @@ -231,11 +235,11 @@ printf "\nInstalling RVM to $rvm_path/" fi -directories=( "${rvm_archives_path:-"$rvm_path/archives"}" "${rvm_src_path:-"$rvm_path/src"}" "${rvm_log_path:-"$rvm_path/log"}" "$rvm_bin_path" "${rvm_gems_path:-"$rvm_path/gems"}" "${rvm_rubies_path:-"$rvm_path/rubies"}" "$rvm_path/config" "${rvm_tmp_path:-"$rvm_path/tmp"}" ) +directories=( "${rvm_archives_path:-"$rvm_path/archives"}" "${rvm_src_path:-"$rvm_path/src"}" "${rvm_log_path:-"$rvm_path/log"}" "$rvm_bin_path" "${rvm_gems_path:-"$rvm_path/gems"}" "${rvm_rubies_path:-"$rvm_path/rubies"}" "$rvm_path/config" "${rvm_tmp_path:-"$rvm_path/tmp"}" "$rvm_path/bin" ) for directory in "${directories[@]}" ; do if [[ ! -d "$directory" ]] ; then @@ -301,15 +305,15 @@ chmod +x "${rvm_bin_path:-"$rvm_path/bin"}"/* # TODO: this is quite suboptimal. # # RC Files # -if [[ -n "$rvm_auto_flag" ]] ; then +if [[ ${rvm_auto_flag:-0} -eq 1 ]] ; then printf "Checking rc files... ($rvm_rc_files)" - if [[ "$rvm_loaded_flag" != "1" ]] ; then + if [[ ${rvm_loaded_flag:-0} -ne 1 ]] ; then for rcfile in $(printf $rvm_rc_files) ; do if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi @@ -490,29 +494,23 @@ fi # # End of gemset migration. # +declare -a files + printf "\n Correct permissions for base binaries in $rvm_bin_path..." mkdir -p "${rvm_bin_path:-"$rvm_path/bin"}" -for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do +files=(rvm rvmsudo rvm-shell rvm-auto-ruby) +for file in "${files[@]}" ; do [[ -s "${rvm_bin_path:-"$rvm_path/bin"}/$file" ]] && chmod +x "${rvm_bin_path:-"$rvm_path/bin"}/$file" done -# Cleanup any .swp files that might have appeared. -files=($( find "$rvm_path/" -mindepth 1 -maxdepth 2 -iname '*.swp' -type f )) - -for file in "${files[@]}" ; do - - [[ -f "$file" ]] && rm -f "$file" - -done - printf "\n Copying manpages into place." files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print)) for file in "${files[@]//.\/}" ; do @@ -521,19 +519,37 @@ cp -R "$install_source_path/man/$man_file" "$rvm_man_path/" done -[[ "$upgrade_flag" = 0 ]] && ./scripts/notes +files=($( find "$rvm_path/" -mindepth 1 -maxdepth 2 -iname '*.swp' -type f )) +if [[ ${#files[@]} -gt 0 ]] ; then + + printf "\n Cleanup any .swp files." + + for file in "${files[@]}" ; do + + if [[ -f "$file" ]] ; then + rm -f "$file" + fi + + done +fi + +if [[ $upgrade_flag -eq 0 ]] ; then + chmod +x ./script/notes # Sometimes things don't clone properly :/ + ./scripts/notes +fi + name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)" if [[ ${upgrade_flag:-0} -eq 1 ]] ; then upgrade_notes check_rubyopt_conditions - + regenerate_wrappers printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n" else