scripts/rvm-install in rvm-0.1.41 vs scripts/rvm-install in rvm-0.1.42
- old
+ new
@@ -42,23 +42,23 @@
if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi
while [[ $# -gt 0 ]] ; do
token="$1" ; shift
case "$token" in
- --auto) rvm_auto_flag=1 ;;
+ --auto) rvm_auto_flag=1 ;;
--prefix) rvm_prefix="$1" ; shift ;;
--version) rvm_path="$(pwd)" ; __rvm_version ; unset rvm_path ; exit ;;
- --help|*) usage ;;
+ --help|*) usage ;;
esac
done
if [[ -z "$rvm_prefix" ]] ; then
__rvm_load_rvmrc
if [[ "root" = "$(whoami)" ]] ; then
- rvm_prefix="/usr/local/"
+ rvm_prefix="${rvm_prefix:-"/usr/local/"}"
else
- rvm_prefix="$HOME/."
+ rvm_prefix="${rvm_prefix:-"$HOME/."}"
fi
fi
if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
@@ -85,11 +85,11 @@
source_path="${source_path:-$cwd}"
rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
-if [[ "root" = "$(whoami)" ]] ; then
+if [[ -z "$rvm_prefix" ]] && [[ "root" = "$(whoami)" ]] ; then
rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
else
rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
fi
@@ -112,11 +112,11 @@
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
+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_patches_path $rvm_tmp_path
for file in README LICENCE ; do
spinner
cp -f "$source_path/$file" "$rvm_path/"
done
@@ -137,20 +137,20 @@
mkdir -p "$rvm_config_path/"
echo '# Users settings file, overrides db file settings and persists across installs.' >> $rvm_config_path/user
fi
scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
-for script_name in $scripts ; do
+for script_name in "${scripts[@]}" ; do
spinner
chmod +x $rvm_scripts_path/$script_name
done
#
# Bin Scripts
#
# Cleanse and purge...
-for file in rvm-prompt rvm rvmsudo ; do
+for file in rvm-prompt rvm rvmsudo rvm-shell ; do
spinner && perl -e 'sleep 0.2'
rm -f "$rvm_bin_path/$file"
cp -f "$source_path/binscripts/$file" $rvm_bin_path/
done
spinner
@@ -158,11 +158,11 @@
#
# RC Files
#
spinner
-if [[ ! -z "$rvm_auto_flag" ]] ; then
+if [[ -n "$rvm_auto_flag" ]] ; then
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
@@ -272,20 +272,20 @@
#
# End of gemset migration.
#
-if [[ "root" = "$(whoami)" ]] ; then
- 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
- printf "\n Copying manpages into place."
- for man_file in $(\ls "$install_source_path/man"); do
- cp -f "$install_source_path/man/$man_file" "$rvm_man_path/$man_file"
- done
-fi
+printf "\n Correct permissions for base binaries in $rvm_bin_path..."
+mkdir -p $rvm_bin_path
+for file in rvm rvmsudo rvm-shell ; do
+ [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
+done; unset file
+printf "\n Copying manpages into place."
+for man_file in $(\ls "$install_source_path/man"); do
+ rm -rf "$rvm_man_path/$man_file"
+ cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
+done
if [[ "$upgrade_flag" -eq 0 ]] ; then
./scripts/notes
fi
@@ -301,32 +301,31 @@
if [[ "$upgrade_flag" -eq 1 ]] ; then
printf "\n$(tput setaf 6)Upgrade Notes\n"
printf "\n * 'rvm notes' tells you OS dependency packages for installing rubies."
printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
- printf "\n * 1.8.7 default patchlevel is p174, override ~/.rvm/config/db in ~/.rvm/config/user"
printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
printf "\n$(tput sgr0)\n"
check_rubyopt_conditions
printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
else
- if [[ "root" != "$(whoami)" ]] ; then
+ if [[ -z "$rvm_prefix" ]] && [[ "root" != "$(whoami)" ]] ; then
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 [[ -s \$HOME/.rvm/scripts/rvm ]] && source \$HOME/.rvm/scripts/rvm"
printf "\n Please note that this must only occur once - so, you only need to add it the first time you install rvm."
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 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 "\n Be absolutely *sure* to REMOVE the '&& return'."
printf "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile."
printf "\n placing all non-interactive items in the .bashrc, including the 'source' line above"
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
+ if [[ -s $HOME/.bashrc ]] && grep -q '&& return' $HOME/.bashrc ; then
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."