Skip to content

Instantly share code, notes, and snippets.

@jmahowald
Created May 6, 2011 15:42
Show Gist options
  • Save jmahowald/959197 to your computer and use it in GitHub Desktop.
Save jmahowald/959197 to your computer and use it in GitHub Desktop.
Bootrsap of RVM
cat <<'BOOTSTRAP_AS_USER' > /home/$app_user/bootstrap_as_user.sh
set -e
bash < <( curl --insecure https://rvm.beginrescueend.com/install/rvm )
rvm_include_string='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'
grep "$rvm_include_string" ~/.bashrc || echo "$rvm_include_string" >> ~/.bashrc
cat <<'RVMRC_CONTENTS' > ~/.rvmrc
rvm_install_on_use_flag=1
rvm_trust_rvmrcs_flag=1
rvm_gemset_create_on_use_flag=1
RVMRC_CONTENTS
BOOTSTRAP_AS_USER
chmod a+x /home/$app_user/bootstrap_as_user.sh
su - $app_user /home/$app_user/bootstrap_as_user.sh
------
su - $app_user
$rvm_path (/usr/local/rvm) does not exist.
@mkocher
Copy link

mkocher commented May 9, 2011

Hmmm, just came across this when trying to solve this problem and the code looked very familiar. I tried your fix but couldn't get it to work for me, and I'm a fan of the install on use flag so the bootstrap script can stay as generic as possible. I've got a fix that seems to work, I'll push it as soon as I'm a little more confident in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment