This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
ubuntu-install.sh
executable file
·54 lines (49 loc) · 1.71 KB
/
ubuntu-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Simple autograder setup.sh for configuring Ubuntu 14.04 LTS EC2 instance. This is the first step to configuring the
# autograder. You will also need to copy the deploy key for any private repos the autograder needs to access as
# ~/.ssh/id_rsa
# get clone only if missing, then cd into it
git-clone-ifmissing-cd() {
if ! test -e "$2"; then
verbose-short git clone "$1" "$2"
fi
verbose-short cd "$2"
}
# gem install only if not installed
gem-install-ifmissing() {
if ! gem list -i $@ > /dev/null; then
verbose-short gem install $@ --no-doc
fi
}
# bundle install only if not installed
bundle-install-ifmissing() {
if ! bundle check > /dev/null; then
verbose-short bundle install
fi
}
# Prepend `verbose` to any command to have it echoed as well as run.
verbose() {
echo 1>&2 ' '
echo 1>&2 $ $@
$@
}
verbose-short() {
echo 1>&2 $ $@
$@
}
# install things
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no # turn off ssh host checking for scripting.
verbose sudo apt-get install -y git curl
if ! test -e ~/.rvm/scripts/rvm; then
verbose curl -sSL https://rvm.io/mpapis.asc | verbose-short gpg --import -
verbose curl -sSL https://get.rvm.io | verbose-short bash -s stable --quiet-curl --ruby=2.2.2
fi
verbose git-clone-ifmissing-cd https://github.com/saasbook/rag.git /home/ubuntu/rag/
# To get a nice footer for screen for .screenrc
verbose cp -f /home/ubuntu/rag/.screenrc /home/ubuntu/.screenrc
verbose source /home/ubuntu/.rvm/scripts/rvm
verbose cd /home/ubuntu/rag/
verbose git checkout master
verbose rvm use 2.2.2 # for some reason, rvm doesn't automatically change ruby version from inside script
verbose gem install bundler
verbose bundle-install-ifmissing