install in rvm-0.1.43 vs install in rvm-0.1.44
- old
+ new
@@ -1,12 +1,20 @@
#!/usr/bin/env bash
+if [[ -z "$rvm_sandboxed" ]]; then
+ if [[ "root" = "$(whoami)" ]] || [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
+ export rvm_sandboxed=0
+ else
+ export rvm_sandboxed=1
+ fi
+fi
+
unset rvm_auto_flag
-install_source_path=$(dirname $0)
+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
+ builtin cd "$install_source_path"
fi
source scripts/version
source scripts/utility
@@ -51,22 +59,22 @@
esac
done
if [[ -z "$rvm_prefix" ]] ; then
__rvm_load_rvmrc
- if [[ "root" = "$(whoami)" ]] ; then
+ if [[ "$rvm_sandboxed" = "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
source scripts/initialize
-if grep -q 'scripts/rvm' $HOME/.bash* || grep -q 'scripts/rvm' $HOME/.zsh*; then
+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
export upgrade_flag=1
else
export upgrade_flag=0
fi
@@ -112,11 +120,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_tmp_path"
for file in README LICENCE ; do
spinner
cp -f "$source_path/$file" "$rvm_path/"
done
@@ -146,11 +154,11 @@
#
# Bin Scripts
#
# Cleanse and purge...
-for file in rvm-prompt rvm rvmsudo rvm-shell ; do
+for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
spinner && perl -e 'sleep 0.2'
rm -f "$rvm_bin_path/$file"
cp -f "$source_path/binscripts/$file" $rvm_bin_path/
done
spinner
@@ -181,34 +189,35 @@
#
# Initial Interpreter Gemsets.
#
spinner
-mkdir -p "$rvm_gemsets_path"
-for gemset_file in $(cd gemsets ; find . -iname '*.gems' | sed 's/^\.\///') ; do
- source_path="$(pwd)/gemsets"
- destination="$rvm_gemsets_path/$gemset_file"
- destination_path="$(dirname "$destination")"
- if [[ ! -s "$destination" ]] ; then
- mkdir -p "$destination_path"
- cp "$source_path/$gemset_file" "$destination"
- fi
-done ; unset destination destination_path source_path gemset_file
+if [[ -d gemsets/ ]] ; then
+ mkdir -p "$rvm_gemsets_path"
+ for gemset_file in $(cd gemsets ; find . -iname '*.gems' | sed 's/^\.\///') ; do
+ destination="$rvm_gemsets_path/$gemset_file"
+ destination_path="$(dirname "$destination")"
+ if [[ ! -s "$destination" ]] ; then
+ mkdir -p "$destination_path"
+ cp "gemsets/$gemset_file" "$destination"
+ fi
+ done ; unset destination destination_path gemset_file
+fi
spinner
-mkdir -p "$rvm_patchsets_path"
-for patchsets_file in $(cd gemsets ; find . -iname '*' | sed 's/^\.\///') ; do
- source_path="$(pwd)/gemsets"
- destination="$rvm_patchsets_path/$patchset_file"
- destination_path="$(dirname "$destination")"
- if [[ ! -s "$destination" ]] ; then
- mkdir -p "$destination_path"
- cp "$source_path/$patchset_file" "$destination"
- fi
-done ; unset destination destination_path source_path patchset_file
+if [[ -d patchsets/ ]] ; then
+ mkdir -p "$rvm_patchsets_path"
+ for patchset_file in $(cd patchsets ; find . -iname '*' | sed 's/^\.\///') ; do
+ destination="$rvm_patchsets_path/$patchset_file"
+ destination_path="$(dirname "$destination")"
+ if [[ ! -s "$destination" ]] ; then
+ mkdir -p "$destination_path"
+ cp "patchsets/$patchset_file" "$destination"
+ fi
+ done ; unset destination destination_path patchset_file
+fi
-
#
# Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
#
rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
mkdir -p "$rvm_rubies_path/"
@@ -274,21 +283,19 @@
# End of gemset migration.
#
printf "\n Correct permissions for base binaries in $rvm_bin_path..."
mkdir -p $rvm_bin_path
-for file in rvm rvmsudo rvm-shell ; do
+for file in rvm rvmsudo rvm-shell rvm-auto-ruby; 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
+[[ "$upgrade_flag" = 0 ]] && ./scripts/notes
name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
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."