|
2 | 2 | # vi: set ft=ruby :
|
3 | 3 |
|
4 | 4 | netplugin_synced_gopath="/opt/golang"
|
| 5 | +host_gobin_path="/opt/go/bin" |
5 | 6 |
|
6 | 7 | provision_common = <<SCRIPT
|
7 | 8 | ## setup the environment file. Export the env-vars passed as args to 'vagrant up'
|
8 | 9 | echo Args passed: [[ $@ ]]
|
9 | 10 | echo 'export GOPATH=#{netplugin_synced_gopath}' > /etc/profile.d/envvar.sh
|
10 | 11 | echo 'export GOBIN=$GOPATH/bin' >> /etc/profile.d/envvar.sh
|
11 | 12 | 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 |
| 13 | +echo 'export PATH=$PATH:#{host_gobin_path}:$GOBIN' >> /etc/profile.d/envvar.sh |
13 | 14 | if [ $# -gt 0 ]; then
|
14 | 15 | echo "export $@" >> /etc/profile.d/envvar.sh
|
15 | 16 | fi
|
16 | 17 |
|
17 |
| -## set the mounted host filesystems to be read-only |
| 18 | +## set the mounted host filesystems to be read-only.Just a safety check |
| 19 | +## to prevent inadvertent modifications from vm. |
18 | 20 | (mount -o remount,ro,exec /vagrant) || exit 1
|
| 21 | +if [ -e #{host_gobin_path} ]; then |
| 22 | + (mount -o remount,ro,exec #{host_gobin_path}) || exit 1 |
| 23 | +fi |
19 | 24 | if [ -e #{netplugin_synced_gopath} ]; then
|
20 | 25 | (mount -o remount,ro,exec #{netplugin_synced_gopath}) || exit 1
|
21 | 26 | fi
|
@@ -86,15 +91,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
86 | 91 | v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
|
87 | 92 | v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
|
88 | 93 | 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"] |
| 94 | + # mount the host directories |
96 | 95 | node.vm.synced_folder ".", "/vagrant"
|
97 | 96 | node.vm.synced_folder ENV['GOPATH'], netplugin_synced_gopath
|
| 97 | + if ENV['CONTIV_HOST_GOBIN'] != nil |
| 98 | + node.vm.synced_folder ENV['CONTIV_HOST_GOBIN'], host_gobin_path |
| 99 | + end |
98 | 100 | node.vm.provision "shell" do |s|
|
99 | 101 | s.inline = provision_common
|
100 | 102 | s.args = ENV['CONTIV_ENV']
|
|
0 commit comments