scripts/rvm-install in wayneeseguin-rvm-0.0.35 vs scripts/rvm-install in wayneeseguin-rvm-0.0.36
- old
+ new
@@ -13,88 +13,136 @@
if [ ! -d "$source_dir" ] ; then unset source_dir ; fi
source_dir="${source_dir:-$cwd}"
rvm_dir=~/.rvm
echo -e "Installing rvm source to ~/.rvm/scripts/rvm..."
-mkdir -p $rvm_dir
-
for dir in src scripts bin log archives config gems examples ; do
mkdir -p $rvm_dir/$dir
done
-for file in ~/.bash_profile ~/.bashrc ~/.zshrc ; do
- if [ -s $file ] ; then
- echo -e "\n\033[0;32m<i>\033[0m Ensuring that rvm script location in $file is scripts/rvm not bin/rvm"
- actual_file=$(file ~/.zshrc | awk '{print $5}')
- sed -i.orig 's/rvm\/bin\/rvm/rvm\/scripts\/rvm/g' $actual_file
- fi
-done
-
-for dir in config scripts examples ; do
- mkdir -p $rvm_dir/$dir
- for file in `/bin/ls $source_dir/$dir/`; do
- cp $source_dir/$dir/$file $rvm_dir/$dir/$file
- done
-done
-
# State what is required to use rvm
echo -e "\n\033[0;32mrvm\033[0m is a shell script that allows a user to manage multiple ruby versions in their own account."
echo -e "$info In order to use rvm the following line must occur in your shell's loading files:"
echo -e "\n\033[0;32m (a)\033[0m if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi"
-while : ; do
- echo -n -e "$question Do you want this (s)cript to set this up for you, or do it (m)anually yourself ('s' or 'm')? "
- read response
- if [ "${response:0:1}" = "s" ] ; then
- echo 'w00t!'
- break
- elif [ "${response:0:1}" = "m" ] ; then
- echo -e "$info Please make sure that this line is in place."
- break
- fi
-done
-
-if [ "${response:0:1}" = "s" ] ; then
-
+results=$(grep 'scripts/rvm' ~/.bash_profile ~/.bashrc ~/.zshrc > /dev/null)
+if [ $? -gt 0 ] ; then
while : ; do
- echo -n -e "$question Do you use b(a)sh or (z)sh or b(o)th for your shell (the default on most *nix systems is bash, press control + C to cancel the installation)\n(a/z/o)? "
+ echo -n -e "$question Do you want this (s)cript to set this up for you, or do it (m)anually yourself ('s' or 'm')? "
read response
- if [ "${response:0:1}" = "a" ] ; then
- user_shell="bash"
+ if [ "${response:0:1}" = "s" ] ; then
+ echo 'w00t!'
break
- elif [ "${response:0:1}" = "z" ] ; then
- user_shell="zsh"
+ elif [ "${response:0:1}" = "m" ] ; then
+ echo -e "$info Please make sure that this line is in place."
break
- elif [ "${response:0:1}" = "o" ] ; then
- user_shell="both"
- break
fi
done
- if [ "$user_shell" = "bash" -o "$user_shell" = "both" ] ; then
+ if [ "${response:0:1}" = "s" ] ; then
- touch ~/.bash_profile
- if [ -z "`grep '\.rvm/scripts/rvm' ~/.bash_profile`" ] ; then
- echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.bash_profile."
- echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.bash_profile
+ while : ; do
+ echo -n -e "$question Do you use b(a)sh or (z)sh or b(o)th for your shell (the default on most *nix systems is bash, press control + C to cancel the installation)\n(a/z/o)? "
+ read response
+ if [ "${response:0:1}" = "a" ] ; then
+ user_shell="bash"
+ break
+ elif [ "${response:0:1}" = "z" ] ; then
+ user_shell="zsh"
+ break
+ elif [ "${response:0:1}" = "o" ] ; then
+ user_shell="both"
+ break
+ fi
+ done
+
+ if [ "$user_shell" = "bash" -o "$user_shell" = "both" ] ; then
+
+ touch ~/.bash_profile
+ if [ -z "`grep '\.rvm/scripts/rvm' ~/.bash_profile`" ] ; then
+ echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.bash_profile."
+ echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.bash_profile
+ fi
+ touch ~/.bashrc
+ if [ -z "`grep '\.rvm/scripts/rvm' ~/.bashrc`" ] ; then
+ echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.bashrc."
+ echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.bashrc
+ fi
+
fi
- touch ~/.bashrc
- if [ -z "`grep '\.rvm/scripts/rvm' ~/.bashrc`" ] ; then
- echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.bashrc."
- echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.bashrc
+
+ if [ "$user_shell" = "zsh" -o "$user_shell" = "both" ] ; then
+
+ touch ~/.zshrc
+ if [ -z "`grep '\.rvm/scripts/rvm' ~/.zshrc`" ] ; then
+ echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.zshrc."
+ echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.zshrc
+ fi
fi
fi
+fi
- if [ "$user_shell" = "zsh" -o "$user_shell" = "both" ] ; then
-
- touch ~/.zshrc
- if [ -z "`grep '\.rvm/scripts/rvm' ~/.zshrc`" ] ; then
- echo "Adding 'if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi' to your ~/.zshrc."
- echo "if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi" >> ~/.zshrc
+echo -e "\n\033[0;32m<i>\033[0m Ensuring that rvm script location in $file is scripts/rvm not bin/rvm for: ~/.bash_profile, ~/.bashrc, ~/.zshrc"
+for file in ~/.bash_profile ~/.bashrc ~/.zshrc ; do
+ if [ -s $file ] ; then
+ if [ -L $file ] ; then # If the file is a symlink,
+ actual_file=`readlink $file` # read the link target so we can preserve it.
+ else
+ actual_file="$file"
fi
+ sed -i.orig 's/rvm\/bin\/rvm/rvm\/scripts\/rvm/g' $actual_file
fi
+done
+if [ -f ~/.rvm/bin/rvm ] ; then
+ echo -e "\n\033[0;32m<i>\033[0m Removing old rvm file from ~/.rvm/bin/rvm"
+ rm -f ~/.rvm/bin/rvm
fi
-source $rvm_dir/scripts/rvm-update
+for dir in config scripts examples ; do
+ mkdir -p $rvm_dir/$dir
+ for file in `/bin/ls $source_dir/$dir/`; do
+ cp $source_dir/$dir/$file $rvm_dir/$dir/$file
+ done
+done
+
+system=`uname`
+if [ "$system" = "Linux" ] ; then
+ rvm_apt_get_binary=`which apt-get 2> /dev/null`
+ rvm_emerge_binary=`which emerge 2> /dev/null`
+ rvm_pacman_binary=`which pacman 2> /dev/null`
+ rvm_yum_binary=`which yum 2> /dev/null`
+
+ echo -e "\033[0;33m <w> \033[0mFor jRuby & ree (if you wish to use it) you will need:"
+ if [ ! -z "$rvm_apt_get_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk libreadline5-dev libssl-dev "
+
+ elif [ ! -z "$rvm_emerge_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo emerge dev-java/sun-jdk dev-java/sun-jre-bin"
+
+ elif [ ! -z "$rvm_pacman_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo pacman -Sy jdk jre"
+
+ elif [ ! -z "$rvm_yum_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0myum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
+
+ else
+ echo -e "\033[0;32m <i> \033[0mThe SUN java runtime environment and development kit."
+ fi
+elif [ "$sytem" = "Darwin" ] ; then
+ echo -e "\033[0;32m <i> \033[0mIf you intend on installing MacRuby you must install LLVM first."
+fi
+
+echo -e "$info There have been a great many updates since previous releases, please:"
+echo -e "$info * remove sourcing of ~/.rvm/current from your shell profiles."
+echo -e "$info * note that ruby gems are now all installed into ~/.rvm/gems"
+
+echo -e "\n$info Please visit the website for much more information: http://rvm.beginrescueend.com/\n"
+echo ' w⦿‿⦿t! '
+echo -e "\n ~ Wayne"
+
+source $rvm_dir/scripts/rvm
+rvm symlinks
+echo
+rvm -v