scripts/rvm-install in rvm-0.1.32 vs scripts/rvm-install in rvm-0.1.33

- old
+ new

@@ -9,11 +9,11 @@ source scripts/version source scripts/utility usage() { - echo -e " + printf " Usage: ${0} [options] options: --auto : Automatically update shell profile files. @@ -25,11 +25,11 @@ spinner_counter=0 spinner() { array=('/' '-' '\\' '|' '/' '-' '\\' '|') index=$((($spinner_counter % 8))) - echo -e -n "\r${array[$index]}" + printf "\r${array[$index]}" let "spinner_counter=spinner_counter+1" command -v perl > /dev/null 2>&1 && perl -e 'sleep 0.5' } if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi @@ -84,23 +84,21 @@ rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}" rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}" rvm_config_path="${rvm_config_path:-"$rvm_path/config"}" rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}" rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}" -rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}" export rvm_gemset_separator="@" # TODO: Remove this after a while. -echo -e "\n$(tput setaf 2)RVM$(tput sgr0) - shell scripts which allow management of multiple ruby interpreters and environments." -echo -e "\n $(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/" -echo -e "\n $(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)" +printf "\n$(tput setaf 2)RVM:$(tput sgr0) shell scripts which allow management of multiple ruby interpreters and environments." +printf "\n$(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/" +printf "\n$(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)" -echo -e "\n********************************************************************************" if [[ "$upgrade_flag" -eq 1 ]] ;then - echo -e -n " Upgrading the RVM installation in $rvm_path/" + printf "\n\n Upgrading the RVM installation in $rvm_path/" else - echo -e -n " Installing rvm to $rvm_path/" + printf "\n\n Installing rvm to $rvm_path/" fi spinner mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path @@ -148,23 +146,23 @@ # # RC Files # spinner if [[ ! -z "$rvm_auto_flag" ]] ; then - echo -e "Checking rc files... ($rvm_rc_files)" + printf "Checking rc files... ($rvm_rc_files)" if [[ "$rvm_loaded_flag" != "1" ]] ; then for rcfile in $(echo $rvm_rc_files) ; do if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi if [[ -s "$HOME/.profile" ]] ; then if ! grep -q '.profile' "$rcfile" ; then echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile." - echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile + printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile fi fi if ! grep -q "scripts\/rvm" "$rcfile" ; then echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile." - echo -e "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile + printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile fi done fi fi @@ -194,102 +192,102 @@ # # Migrate old gemset directories to new gemset pattern. # spinner -echo -e -n "\r*" # Stop spinner. +printf "\r*" # Stop spinner. for gemset in $rvm_path/gems/*\%* ; do new_path=${gemset/\%/${rvm_gemset_separator}} if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then - echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator." + printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator." mv $gemset $new_path fi done for gemset in $rvm_path/gems/*\+* ; do new_path=${gemset/\+/${rvm_gemset_separator}} if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then - echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator." + printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator." mv $gemset $new_path fi done for gemset in $rvm_path/gems/*\@ ; do new_path=$(echo $gemset | sed -e 's#\@$##') if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then - echo -e " Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator." + printf "\n Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator." mv $gemset $new_path fi done -# Upgrade any default file. -if [[ -s $rvm_config_path/default ]] && grep -q '\%' $rvm_config_path/default ; then - sed -e "s#\%#${rvm_gemset_separator}#g" $rvm_config_path/default > $rvm_config_path/default.new - mv $rvm_config_path/default.new $rvm_config_path/default +# Move from legacy defaults to the new, alias based system. +if [[ -s "$rvm_config_path/default" ]]; then + original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")" + if [[ -n "$original_version" ]]; then + $rvm_scripts_path/alias create default "$original_version" &> /dev/null + fi + unset original_version + rm -rf "$rvm_config_path/default" fi # # End of gemset migration. # if [[ "root" = "$(whoami)" ]] ; then - echo -e "\n Symlinking rvm to $rvm_symlink_path/rvm ..." - mkdir -p $rvm_symlink_path - ln -nfs $rvm_bin_path/rvm $rvm_symlink_path/rvm - ln -nfs $rvm_bin_path/rvmsudo $rvm_symlink_path/rvmsudo - chmod +x $rvm_symlink_path/rvm - chmod +x $rvm_symlink_path/rvmsudo + printf "\n Symlinking rvm to $rvm_bin_path/rvm ..." + mkdir -p $rvm_bin_path + chmod +x $rvm_bin_path/rvm + chmod +x $rvm_bin_path/rvmsudo fi if [[ "$upgrade_flag" -eq 0 ]] ; then - echo -e "\n********************************************************************************" ./scripts/notes fi -echo -e "\n********************************************************************************" name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)" -echo -e "\n${name:-"$(whoami)"},\n" -echo -e "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable." -echo -e "If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know." -echo -e "My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST." -echo -e "If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back." -echo -e "Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'." -echo -e "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!" -echo -e "\n ~ Wayne" -echo -e "\n********************************************************************************" +printf "\n\n${name:-"$(whoami)"},\n" +printf "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable." +printf "\nIf you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know." +printf "\nMy irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST." +printf "\nIf I do not respond right away, please hang around after asking your question, I will respond as soon as I am back." +printf "\nBe sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'." +printf "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!" +printf "\n ~ Wayne\n" if [[ "$upgrade_flag" -eq 1 ]] ; then - echo -e "\n$(tput setaf 6)**** NOTICE *************************************************************************************" - echo -e "* Gemset separator has changed, it is now @ and will remain unless any rubies error using it. *" - echo -e "* If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' *" - echo -e "*************************************************************************************************$(tput sgr0)\n" - echo -e "Upgrade of RVM in $rvm_path/ is complete.\n" + printf "\n$(tput setaf 6)Upgrade Notes\n" + printf "\n * Gemset separator is '@' and will remain unless any rubies error using it." + printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' " + printf "\n * Do not forget that 'rvm notes' tells you OS dependency packages for installing rubies." + printf "\n$(tput sgr0)\n" + printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n" else if [[ "root" != "$(whoami)" ]] ; then - echo -e "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)" - echo -e "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:" - echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi" - echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)." - echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:" - echo -e "\n if [[ ! -z "$PS1" ]] ; then" - echo -e "\n ... original content that was below the && return line ..." - echo -e "\n fi # <= be sure to close the if." - echo -e "\n #EOF .bashrc" - echo -e "\n Be absolutely *sure* to REMOVE the '&& return'." - echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile." - echo -e "\n placing all non-interactive items in the .bashrc" - echo -e "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n" + printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)" + printf "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:" + printf "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi" + printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)." + printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:" + printf "\n if [[ ! -z "$PS1" ]] ; then" + printf "\n ... original content that was below the && return line ..." + printf "\n fi # <= be sure to close the if." + printf "\n #EOF .bashrc" + printf "\n Be absolutely *sure* to REMOVE the '&& return'." + printf "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile." + printf "\n placing all non-interactive items in the .bashrc" + printf "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n" fi if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then - echo -e "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc. - This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to: - if [[ -n "\$PS1" ]] ; then - ... original content that was below the && return line ... - fi # <= be sure to close the if. - #EOF .bashrc - - If you have any questions about this please visit #rvm on irc.freenode.net.\n" + printf "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc." + printf "\n This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:" + printf "\n if [[ -n "\$PS1" ]] ; then" + printf "\n ... original content that was below the && return line ..." + printf "\n fi # <= be sure to close the if." + printf "\n #EOF .bashrc" + printf "\nEven if you use zsh you should still adjust the .bashrc as above." + printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n" fi - echo -e "Installation of RVM to $rvm_path/ is complete.\n\n" + printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n" fi exit 0