blob: 8c3af943f42af8cc3662ee30dda2d9d929106bd8 [file] [log] [blame]
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -04001#!/bin/bash
2
Sergio Slobodrian7c483622017-06-13 15:51:34 -04003uId=`id -u`
4vmName="voltha_voltha${uId}"
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -04005
6# Voltha directory
7cd ..
8
Sergio Slobodrian7c483622017-06-13 15:51:34 -04009# Rename voltha for multi-user support
10sed -i -e '/server_name/s/.*/server_name: "voltha'${uId}'"/' settings.vagrant.yaml
11# Build voltha in test mode
12if [ $# -eq 1 -a "$1" == "test" ]; then
13 sed -i -e '/test_mode/s/.*/test_mode: "true"/' settings.vagrant.yaml
14fi
15
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -040016# Destroy the VM if it's running
Sergio Slobodrian7c483622017-06-13 15:51:34 -040017vagrant destroy voltha${uId}
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -040018
19# Bring up the VM.
Sergio Slobodrian7c483622017-06-13 15:51:34 -040020vagrant up voltha${uId}
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -040021
22# Get the VM's ip address
23ipAddr=`virsh domifaddr $vmName | tail -n +3 | awk '{ print $4 }' | sed -e 's~/.*~~'`
24
Sergio Slobodrian7c483622017-06-13 15:51:34 -040025
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -040026# Run all the build commands
Sergio Slobodrian7c483622017-06-13 15:51:34 -040027ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i .vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr "cd /cord/incubator/voltha && . env.sh && make fetch && make build"