Last active
December 14, 2020 19:50
-
-
Save fernandolopez/6431624 to your computer and use it in GitHub Desktop.
Install RVM without sudo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Change this: | |
RUBY_VERSION=1.9.3 | |
echo "su -c apt-get install curl" | |
while ! su -c apt-get install curl; do | |
true | |
done | |
curl -L https://get.rvm.io | bash -s stable --autolibs=read-fail | |
if ! grep 'source $HOME/.bash_profile' ~/.bashrc; then | |
echo 'source $HOME/.bash_profile' >> ~/.bashrc | |
fi | |
source ~/.profile | |
rvm autolibs read-fail | |
deps=$(rvm install $RUBY_VERSION 2>&1 | grep "Missing required | |
packages" | cut -d: -f2 | tr ',' ' ' | tr -d '.') | |
if [ -z "$deps" ]; then | |
echo "RVM don't require other packages to install Ruby $RUBY_VERSION" | |
else | |
echo "Missing packages" | |
echo "su -c \"apt-get install $deps\"" | |
while ! su -c "apt-get install $deps"; do | |
true | |
done | |
rvm install $RUBY_VERSION | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment