-
Notifications
You must be signed in to change notification settings - Fork 0
/
vagrant-provisioning.sh
52 lines (40 loc) · 1.35 KB
/
vagrant-provisioning.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
#!/usr/bin/env bash
NODE_VERSION=10.15.3
# Installing nvm and nodejs
echo "Installing nvm..."
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
echo "source /home/vagrant/.nvm/nvm.sh" >> /home/vagrant/.profile
source /home/vagrant/.profile
# Set node version
echo "Using nodejs version: $NODE_VERSION"
nvm install $NODE_VERSION
nvm alias default $NODE_VERSION
# Install global packages
# npm install -g gulp
echo "Mounting virtual directories to avoid symlink error to /home/vagrant/"
# Migrate folders to home folder to avoid simlink errors
# declare -a folders=("node_modules" "data" "tmp")
declare -a folders=("node_modules")
## now loop through the above array
for i in "${folders[@]}"
do
# Remove folder if already present
rm -rf /vagrant/$i
mkdir /vagrant/$i
if [ ! -d /home/vagrant/$i ]; then
# Control will enter here if directory doesn't exists.
mkdir /home/vagrant/$i
fi
echo "$i. Mounting $i virtual directory..."
sudo mount --bind /home/vagrant/$i /vagrant/$i/
done
# echo "2. Mounting history virtual directory..."
# sudo mount --bind /home/vagrant/history /vagrant/history/
echo "cd /vagrant" >> /home/vagrant/.profile
# Installing dependencies
cd /vagrant
## Install global packages
pip3 install troncli
npm install -g tronbox truffle-flattener
# npm install --only=production
echo "Provisioning finished"