|
2 | 2 | # vi: set ft=ruby :
|
3 | 3 |
|
4 | 4 | netplugin_synced_gopath="/opt/golang"
|
| 5 | +host_gobin_path="/opt/go/bin" |
| 6 | +host_goroot_path="/opt/go/root" |
5 | 7 |
|
6 | 8 | provision_common = <<SCRIPT
|
7 | 9 | ## setup the environment file. Export the env-vars passed as args to 'vagrant up'
|
8 | 10 | echo Args passed: [[ $@ ]]
|
9 | 11 | echo 'export GOPATH=#{netplugin_synced_gopath}' > /etc/profile.d/envvar.sh
|
10 | 12 | echo 'export GOBIN=$GOPATH/bin' >> /etc/profile.d/envvar.sh
|
11 | 13 | echo 'export GOSRC=$GOPATH/src' >> /etc/profile.d/envvar.sh
|
12 |
| -echo 'export PATH=$PATH:/usr/local/go/bin:$GOBIN' >> /etc/profile.d/envvar.sh |
| 14 | +echo 'export GOROOT=#{host_goroot_path}' >> /etc/profile.d/envvar.sh |
| 15 | +echo 'export PATH=$PATH:#{host_gobin_path}:$GOBIN' >> /etc/profile.d/envvar.sh |
13 | 16 | if [ $# -gt 0 ]; then
|
14 | 17 | echo "export $@" >> /etc/profile.d/envvar.sh
|
15 | 18 | fi
|
16 | 19 |
|
17 |
| -## set the mounted host filesystems to be read-only |
| 20 | +## set the mounted host filesystems to be read-only.Just a safety check |
| 21 | +## to prevent inadvertent modifications from vm. |
18 | 22 | (mount -o remount,ro,exec /vagrant) || exit 1
|
| 23 | +if [ -e #{host_gobin_path} ]; then |
| 24 | + (mount -o remount,ro,exec #{host_gobin_path}) || exit 1 |
| 25 | +fi |
| 26 | +if [ -e #{host_goroot_path} ]; then |
| 27 | + (mount -o remount,ro,exec #{host_goroot_path}) || exit 1 |
| 28 | +fi |
19 | 29 | if [ -e #{netplugin_synced_gopath} ]; then
|
20 | 30 | (mount -o remount,ro,exec #{netplugin_synced_gopath}) || exit 1
|
21 | 31 | fi
|
@@ -86,15 +96,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
86 | 96 | v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
|
87 | 97 | v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
|
88 | 98 | end
|
89 |
| - # mount host filesystems as read only since these files potentially |
90 |
| - # get shared between multiple vms. Just a safety check to prevent |
91 |
| - # inadvertent modifications. XXX: This doesn't seem to be working, |
92 |
| - # so will remount the parition as part of provisioning later and |
93 |
| - # change options |
94 |
| - #node.vm.synced_folder ".", "/vagrant", mount_options: ["ro", "exec"] |
95 |
| - #node.vm.synced_folder ENV['GOPATH'], netplugin_synced_gopath, mount_options: ["ro", "exec"] |
| 99 | + # mount the host directories |
96 | 100 | node.vm.synced_folder ".", "/vagrant"
|
97 | 101 | node.vm.synced_folder ENV['GOPATH'], netplugin_synced_gopath
|
| 102 | + if ENV['CONTIV_HOST_GOBIN'] != nil |
| 103 | + node.vm.synced_folder ENV['CONTIV_HOST_GOBIN'], host_gobin_path |
| 104 | + end |
| 105 | + if ENV['CONTIV_HOST_GOROOT'] != nil |
| 106 | + node.vm.synced_folder ENV['CONTIV_HOST_GOROOT'], host_goroot_path |
| 107 | + end |
98 | 108 | node.vm.provision "shell" do |s|
|
99 | 109 | s.inline = provision_common
|
100 | 110 | s.args = ENV['CONTIV_ENV']
|
|
0 commit comments