sadmicrowave
sadmicrowave

Reputation: 40912

Linux Install RVM without using CURL

My current environment (including a corporate proxy) is not allowing me to install RVM with CURL or WGET for something reason. Is there another way to install RVM from source without these utilities? Every web search I've done returns the 'curl' way.

Any ideas?

Upvotes: 1

Views: 1464

Answers (2)

tessi
tessi

Reputation: 13574

modifying rvm scripts is not a good idea

I was thinking about your question/my answer while trying to sleep... and I couldn't get an eye closed without writing you another answer. Hacking the rvm install script is really not what you should do. Rvm uses curl everywhere (installation, downloading rubies, updating, ...). And you have to download many more things -- for example gems. Replacing every curl-call in every script is not maintainable.

proposed solution

The good thing about rvm is, that is stores all its data in the ~/.rvm directory. Considering this, you can install rvm on a remote computer (or VM), which is as similar as possible (same OS, same OS version, same libraries) to your development computer. Install all the rubies, gemsets and gems you need. Then move the zipped ~/.rvm directory to your development computer and unpack it to ~/.rvm.

Don't forget to do

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

to source rvm while loading your bash.

If you ever have to update or install gems or ruby versions, do your business on the remote computer, and copy ~/.rvm again.

my experience with this setup

I use this setup (although it is automated with our CI server) for ¬2 years now for a production environment which is in a similar wicked corporate network. Changing gems/rubies is harder than it should be, but it works without an internet connection.

Edit: Added a paragraph about my experience with this setup

Upvotes: 2

tessi
tessi

Reputation: 13574

You find the rvm install script here. You can

  1. download it
  2. modify the parts where curl is used
  3. execute the script, which now refers to the manually downloaded files

1. Download

Download this file to /tmp/rvm-installer . Now download the rvm.tar.gz file to /tmp/rvm-1.19.6.tar.gz

2. modify the file

At line 148 begins function fetch_version. Replace it with the following function:

fetch_version()
{
    echo '1.19.6' # the current version, as of writing this
}

At line 161 (within install_release) the get_and_unpack function is called. replace the function call with:

get_and_unpack \
  /tmp/rvm-${_version}.tar.gz \
  rvm-${_version}.tar.gz

At line 212 (within get_and_unpack) replace

__rvm_curl ${_url} -o ${rvm_archives_path}/${_file} ||

with:

mv ${_url} ${rvm_archives_path}/${_file} ||

3. finally install rvm

cd /tmp
cat rvm-installer | bash -s -- --version latest --autolibs=enabled

Disclaimer: This is still a hack. It installs rvm, but I don't know about updating (here rvm uses curl again). Good luck :)

Upvotes: 0

Related Questions