|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Install gauntlt using rvm |
| 3 | + |
| 4 | +# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/ |
| 5 | +set -euo pipefail |
| 6 | +IFS=$'\n\t' |
| 7 | + |
| 8 | +# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true" |
| 9 | +${DEBUG:-false} && set -vx |
| 10 | +# Credit to https://stackoverflow.com/a/17805088 |
| 11 | +# and http://wiki.bash-hackers.org/scripting/debuggingtips |
| 12 | +export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' |
| 13 | + |
| 14 | +# Credit to http://stackoverflow.com/a/246128/424301 |
| 15 | +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 16 | +#shellcheck disable=SC1090 |
| 17 | +. "$DIR/common.sh" |
| 18 | + |
| 19 | +function quick_yum_install() { |
| 20 | + declare package |
| 21 | + package=${1?"You must specify a package to install"} |
| 22 | + if ! rpm -q "$package" > /dev/null; then |
| 23 | + sudo yum -y -q install "$package" |
| 24 | + else |
| 25 | + echo "$package already installed, skipping" |
| 26 | + fi |
| 27 | +} |
| 28 | + |
| 29 | +quick_yum_install ruby-devel |
| 30 | +quick_yum_install nmap |
| 31 | + |
| 32 | +if [[ ! -f /etc/profile.d/rvm.sh ]]; then |
| 33 | + curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - |
| 34 | + curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - |
| 35 | + curl -L get.rvm.io | bash -s stable |
| 36 | + # rvm hates the bash options -eu |
| 37 | + set +eu |
| 38 | + #shellcheck disable=SC1091 |
| 39 | + source /etc/profile.d/rvm.sh |
| 40 | + rvm reload |
| 41 | + rvm requirements run |
| 42 | +else |
| 43 | + echo "rvm already installed" |
| 44 | +fi |
| 45 | +# rvm hates the bash options -eu |
| 46 | +set +eu |
| 47 | +#shellcheck disable=SC1091 |
| 48 | +source /etc/profile.d/rvm.sh |
| 49 | +rvm reload |
| 50 | +rvm install 2.6.0 |
| 51 | +rvm alias create default ruby-2.6.0 |
| 52 | +rvm list |
| 53 | +rvm use 2.6 --default |
| 54 | +set -eu |
| 55 | +if is_ec2; then |
| 56 | + usermod -a -G rvm centos |
| 57 | +else |
| 58 | + usermod -a -G rvm vagrant |
| 59 | +fi |
| 60 | +ruby --version |
| 61 | + |
| 62 | +if ! (gem list gauntlt | grep gauntlt > /dev/null); then |
| 63 | + echo 'gem: --no-rdoc --no-ri' > ~/.gemrc |
| 64 | + gem install gauntlt |
| 65 | +fi |
0 commit comments