forked from ciscoheat/asynctools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision.sh
151 lines (112 loc) · 3.88 KB
/
provision.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env bash
echo "=== Starting provision script..."
cd /vagrant
echo "=== Adding 'cd /vagrant' to .profile"
cat >> /home/vagrant/.profile <<EOL
cd /vagrant
EOL
echo "=== Updating apt..."
apt-get update >/dev/null 2>&1
# Used in many dependencies:
apt-get install python-software-properties -y
mkdir www
chown vagrant:vagrant www
echo "=== Installing Apache..."
apt-get install -y apache2
# Enable mod_rewrite, allow .htaccess and fix a virtualbox bug according to
# https://github.com/mitchellh/vagrant/issues/351#issuecomment-1339640
a2enmod rewrite
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/sites-enabled/000-default
echo EnableSendFile Off > /etc/apache2/conf.d/virtualbox-bugfix
# Link to www dir
rm -rf /var/www
ln -fs /vagrant/www /var/www
echo "=== Installing curl..."
apt-get install -y curl
echo "=== Installing PHP..."
apt-get install -y php5 php5-gd php5-mysql php5-curl php5-cli php5-sqlite php5-xdebug php-apc
cat > /etc/php5/conf.d/vagrant.ini <<EOL
display_errors = On
html_errors = On
xdebug.max_nesting_level=10000
EOL
echo "=== Installing PHP utilities (Composer)..."
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
echo "=== Installing PHP utilities (phing)..."
wget -q -O /usr/local/bin/phing.phar http://www.phing.info/get/phing-latest.phar && chmod 755 /usr/local/bin/phing.phar
echo "=== Installing Mysql..."
export DEBIAN_FRONTEND=noninteractive
apt-get -q -y install mysql-server mysql-client
echo "=== Creating Mysql DB (test)..."
mysql -u root -e "create database test"
echo "=== Restarting Apache..."
service apache2 restart
echo "=== Installing Haxe 3.2.1..."
wget -q http://www.openfl.org/builds/haxe/haxe-3.2.1-linux-installer.tar.gz -O - | tar -xv
sh install-haxe.sh -y >/dev/null 2>&1
rm -f install-haxe.sh
echo /usr/lib/haxe/lib/ | haxelib setup
echo /usr/lib/haxe/lib/ > /home/vagrant/.haxelib
chown vagrant:vagrant /home/vagrant/.haxelib
echo "=== Installing mod_neko for Apache..."
cat > /etc/apache2/conf.d/neko <<EOL
LoadModule neko_module /usr/lib/neko/mod_neko2.ndll
AddHandler neko-handler .n
DirectoryIndex index.n
EOL
mkdir /vagrant/src
cat > /vagrant/src/Index.hx <<EOL
class Index {
static function main() {
trace("Hello World !");
}
}
EOL
cat > /vagrant/src/build.hxml <<EOL
-neko ../www/index.n
-main Index
EOL
chown -R vagrant:vagrant src
su vagrant -c 'cd /vagrant/src && haxe build.hxml'
service apache2 restart
echo "=== Installing Haxe targets:"
echo "=== Installing C++..."
apt-get install -y gcc-multilib g++-multilib
haxelib install hxcpp >/dev/null 2>&1
echo "=== Installing C#..."
apt-get install -y mono-devel mono-mcs
haxelib install hxcs >/dev/null 2>&1
echo "=== Installing Java..."
haxelib install hxjava >/dev/null 2>&1
echo "=== Installing PHP..."
apt-get install -y php5-cli
echo "=== Installing Flash (xvfb)..."
apt-get install -y xvfb
echo "=== Installing Node.js..."
add-apt-repository ppa:chris-lea/node.js -y
apt-get update
apt-get install nodejs -y
# npm config set spin=false
echo "=== Installing Phantomjs (js testing)..."
npm install -g phantomjs-prebuilt
echo "=== Installing Python 3.4..."
add-apt-repository ppa:fkrull/deadsnakes -y
apt-get update
apt-get install python3.4 -y
ln -s /usr/bin/python3.4 /usr/bin/python3
echo "=== Installing Java 8 JDK (openjdk)..."
add-apt-repository ppa:openjdk-r/ppa -y
apt-get update
apt-get install openjdk-8-jdk -y
echo "If you have several java versions and want to switch:"
echo "sudo update-alternatives --config java"
echo "sudo update-alternatives --config javac"
echo ""
echo "Current java version:"
java -version
sed -i 's/precise64/asynctools/g' /etc/hostname /etc/hosts
echo "=== Provision script finished!"
echo "Change timezone: sudo dpkg-reconfigure tzdata"
echo "Change hostname: sudo pico /etc/hostname && sudo pico /etc/hosts"
echo ""
echo "If you have renamed the vm with '-n', execute 'vagrant reload' to finish the process."