Skip to content

Instantly share code, notes, and snippets.

@rickhull
Created July 30, 2010 04:30
Show Gist options
  • Save rickhull/499901 to your computer and use it in GitHub Desktop.
Save rickhull/499901 to your computer and use it in GitHub Desktop.
# install file, edited from http://bit.ly/rvm-install-system-wide
#!/usr/bin/env bash
# Require root to install it.
if [[ "$(whoami)" != "root" ]]; then
echo "Please rerun this installer as root." >&2
exit 1
fi
# Check for the presence of git.
if ! command -v git >/dev/null 2>&1 ; then
echo "Please ensure git is installed and available in PATH to continue." >&2
exit 1
fi
# Load the rvm config.
[[ -s /etc/rvmrc ]] && source /etc/rvmrc
[[ -s "$HOME/.rvmrc" ]] && source "$HOME/.rvmrc"
rvm_path="${rvm_path:-"/usr/local/rvm"}"
mkdir -p "$rvm_path/src/"
builtin cd "$rvm_path/src"
rm -rf ./rvm/
echo "about to clone"
#CLONE="git clone --depth 1 http://github.com/wayneeseguin/rvm.git"
CLONE="git clone http://github.com/wayneeseguin/rvm.git"
echo "$CLONE"
$CLONE
echo "done cloning"
builtin cd rvm
"Running the install script."
bash ./scripts/install
rvm_group_name="${rvm_group_name:-"rvm"}"
if cat /etc/group | cut -d: -f1 | grep -q "^${rvm_group_name}$"; then
echo "Group exists, proceeding with installation."
else
echo "Creating the group '$rvm_group_name'"
groupadd -f "$rvm_group_name"
fi
echo "Adding root the '$rvm_group_name'"
usermod -a -G "$rvm_group_name" "$(whoami)"
echo "Setting up group permissions"
for dir in rvm bin share/man; do
chown -R root:"$rvm_group_name" /usr/local/$dir
chmod -R g+w /usr/local/$dir
done; unset dir
echo "Generating system wide rvmrc"
rm -f /etc/rvmrc
touch /etc/rvmrc
cat > /etc/rvmrc <<END_OF_RVMRC
# Setup default configuration for rvm.
export rvm_path="/usr/local/rvm"
export rvm_prefix="/usr/local"
export rvm_bin_path="\$rvm_prefix/bin"
export rvm_man_path="\$rvm_prefix/share/man"
END_OF_RVMRC
echo "Generating /usr/local/lib/rvm to load rvm"
rm -f /usr/local/lib/rvm
touch /usr/local/lib/rvm
cat > /usr/local/lib/rvm <<END_OF_RVM_SH
# Automatically source rvm
if [[ -s "\$HOME/.rvm/scripts/rvm" ]]; then
source "\$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
source "/usr/local/rvm/scripts/rvm"
fi
END_OF_RVM_SH
echo "Correct permissions on rvmrc and load_rvm"
# Finally, ensure the rvmrc is owned by the group.
for file in /etc/rvmrc /usr/local/lib/rvm ; do
chown root:"$rvm_group_name" "$file"
chmod g+w "$file"
done; unset file
echo "To use, source '/usr/local/lib/rvm' to your shell profile."
################################3
# install output
planet@qa-hmb03-ny:~$ sudo bash rvm_sys_install.bash
about to clone
git clone http://github.com/wayneeseguin/rvm.git
Initialized empty Git repository in /usr/local/rvm/src/rvm/.git/
remote: Counting objects: 12378, done.
remote: Compressing objects: 100% (3677/3677), done.
remote: Total 12378 (delta 8098), reused 11400 (delta 7397)
Receiving objects: 100% (12378/12378), 1.81 MiB | 176 KiB/s, done.
Resolving deltas: 100% (8098/8098), done.
done cloning
rvm_sys_install.bash: line 35: Running the install script.: command not found
grep: /home/planet/.zsh*: No such file or directory
RVM: shell scripts which allow management of multiple ruby interpreters and environments.
RTFM: http://rvm.beginrescueend.com/
HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
* Installing rvm to /usr/local/rvm/
Correct permissions for base binaries in /usr/local/bin...
Copying manpages into place.cp: cannot stat `./scripts/man/./scripts/man': Not a directory
Notes for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu maverick (development branch)" )
* NOTE: MRI stands for Matz's Ruby Interpreter (1.8.X, 1.9.X), ree stands for Ruby Enterprise Edition and rbx stands for Rubinius.
* curl is required.
* patch is required (for ree, some ruby head's).
* If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.
* For JRuby (if you wish to use it) you will need:
$ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
* For MRI & ree (if you wish to use it) you will need (depending on what you are installing):
$ aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf
* For IronRuby (if you wish to use it) you will need:
$ aptitude install curl mono-2.0-devel
root,
Thank you for using rvm. I hope that it makes your work easier and more enjoyable.
If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know.
My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST.
If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back.
Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'.
w⦿â¿â¦¿t!
~ Wayne
WARNING: 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
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.
Installation of RVM to /usr/local/rvm/ is complete.
Group exists, proceeding with installation.
Adding root the 'rvm'
Setting up group permissions
Generating system wide rvmrc
Generating /usr/local/lib/rvm to load rvm
Correct permissions on rvmrc and load_rvm
To use, source '/usr/local/lib/rvm' to your shell profile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment