#!/bin/bash set -e echo "Updating package list" sudo apt-get update > /dev/null echo "Ensuring curl is available" sudo apt-get install -y curl > /dev/null echo "Setting up RVM" user=$1 [ -z "$user" ] && user="ubuntu" test -d /usr/local/rvm || curl -L https://get.rvm.io | sudo bash -s stable test -e /usr/local/rvm || sudo tee /etc/profile.d/rvm.sh > /dev/null < /dev/null || sudo useradd -m $user -G sudo,rvm,admin -s /bin/bash test -e /etc/rvmrc || sudo tee /etc/rvmrc > /dev/null < /dev/null then to_install="$to_install $package" fi done if [ -z "$to_install" ] then echo "Satisfied RVM requirements" else echo "Installing missing RVM requirements: $to_install" sudo apt-get --no-install-recommends install -y $to_install fi