#!/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. if [[ -z "$rvm_ignore_rvmrc" ]]; then [[ -s /etc/rvmrc ]] && source /etc/rvmrc [[ -s "$HOME/.rvmrc" ]] && source "$HOME/.rvmrc" fi rvm_path="${rvm_path:-"/usr/local/rvm"}" export rvm_selfcontained=0 mkdir -p "$rvm_path/src/" builtin cd "$rvm_path/src" rm -rf ./rvm/ git clone --depth 1 git://github.com/wayneeseguin/rvm.git || git clone http://github.com/wayneeseguin/rvm.git builtin cd rvm echo "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 < /usr/local/lib/rvm <