-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathBakefile
77 lines (58 loc) · 1.54 KB
/
Bakefile
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Used to generate AWS AMI for tutorial
sudo yum update -y
echo "Disabling SELINUX"
sudo tee /etc/selinux/config <<-'EOF'
SELINUX=disabled
SELINUXTYPE=targeted
EOF
echo "Setting hostname"
sudo tee /etc/hostname <<-'EOF'
gt
EOF
echo "Getting Git"
sudo yum install -y git
echo "Getting Go"
curl -o /tmp/go.tgz https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
echo "Extracting Go"
sudo tar -C /usr/local -zxf /tmp/go.tgz
rm /tmp/go.tgz
echo "Setting up Go environment"
sudo tee /etc/profile.d/go.sh <<-'EOF'
export GOROOT=/usr/local/go
if [[ ${PATH} != *"${GOROOT}/bin"* ]]; then
export PATH=${PATH}:${GOROOT}/bin
fi
EOF
sudo /usr/sbin/useradd vagrant
echo golang | sudo passwd --stdin vagrant
sudo tee -a /etc/ssh/sshd_config <<-'EOF'
Match User vagrant
PasswordAuthentication yes
EOF
sudo tee /home/vagrant/.bashrc <<-'EOF'
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export GOPATH=/home/vagrant/tutorial/workspace
EOF
sudo chown vagrant:vagrant /home/vagrant/.bashrc
sudo chmod 0600 /home/vagrant/.bashrc
sudo tee /home/vagrant/.bash_profile <<-'EOF'
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
if [ ! -e $HOME/tutorial ]; then
git clone https://github.com/cmceniry/gotutorial.git tutorial
fi
EOF
sudo chown vagrant:vagrant /home/vagrant/.bash_profile
sudo chmod 0600 /home/vagrant/.bash_profile
echo "Done"