source: grass/branches/releasebranch_7_2/Vagrantfile

Last change on this file was 70812, checked in by martinl, 7 years ago

Vagrantfile cosmentics (fix sed mirrors) (merge r70811 from trunk)

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby
File size: 3.2 KB
Line 
1# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4### Inspired by https://svn.osgeo.org/gdal/trunk/gdal/Vagrantfile
5
6require 'socket'
7
8# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
9VAGRANTFILE_API_VERSION = "2"
10
11Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
12
13 vm_ram = ENV['VAGRANT_VM_RAM'] || 1024
14 vm_cpu = ENV['VAGRANT_VM_CPU'] || 1
15
16 config.vm.box = "xenial64"
17
18 config.vm.hostname = "grass-gis-vagrant"
19 config.vm.box_url = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box"
20 config.vm.define "grass-gis-vagrant" do |host|
21
22 config.vm.network :forwarded_port, guest: 80, host: 8080
23
24 host.vm.provider :virtualbox do |vb|
25 vb.customize ["modifyvm", :id, "--memory", vm_ram]
26 vb.customize ["modifyvm", :id, "--cpus", vm_cpu]
27 vb.customize ["modifyvm", :id, "--ioapic", "on"]
28 vb.name = "grass-gis-vagrant"
29 end
30
31 config.ssh.forward_agent = true
32 config.ssh.forward_x11 = true
33
34 ### Define your GRASS data directory to be synce'd on virtual machine
35 # grassdata_dir = "/opt/grassdata"
36 # host.vm.synced_folder grassdata_dir, "/home/vagrant/grassdata"
37
38 ppaRepos = [
39 "ppa:ubuntugis/ubuntugis-unstable"
40 ]
41
42 packageList = [
43 "autoconf2.13",
44 "autotools-dev",
45 "make",
46 "g++",
47 "gettext",
48 "flex",
49 "bison",
50 "libcairo2-dev",
51 "libfftw3-dev",
52 "libfreetype6-dev",
53 "libgdal-dev",
54 "libgeos-dev",
55 "libglu1-mesa-dev",
56 "libjpeg-dev",
57 "libpng-dev",
58 "libtiff-dev",
59 "libmysqlclient-dev",
60 "libncurses5-dev",
61 "libpq-dev",
62 "libproj-dev",
63 "proj-bin",
64 "libreadline-dev",
65 "libsqlite3-dev",
66 "libwxgtk3.0-dev",
67 "libxmu-dev",
68 "python",
69 "python-wxgtk3.0",
70 "python-dev",
71 "python-numpy",
72 "python-ply",
73 "python-pil",
74 "libnetcdf-dev",
75 "netcdf-bin",
76 "libblas-dev",
77 "liblapack-dev",
78 "unixodbc-dev",
79 "zlib1g-dev",
80 "liblas-c-dev"
81 ]
82
83 unless File.exists?(".no_apt_cache")
84 cache_dir = "apt-cache/#{config.vm.box}"
85 FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
86 host.vm.synced_folder cache_dir, "/var/cache/apt/archives"
87 end
88
89 if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/grass-gis-vagrant/*/id").empty?
90 pkg_cmd = "sed -i 's#deb http://archive.ubuntu.com/ubuntu#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; "
91 pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; "
92
93 if ppaRepos.length > 0
94 ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
95 pkg_cmd << "apt-get update -qq; "
96 end
97
98 # install packages we need we need
99 pkg_cmd << "apt-get install -q -y " + packageList.join(" ") << " ; "
100 host.vm.provision :shell, :inline => pkg_cmd
101
102 scripts = [
103 "clean.sh",
104 ];
105 scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "tools/vagrant/" << script }
106 end
107 scripts = [
108 "compile.sh",
109 ];
110 scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "tools/vagrant/" << script }
111 end
112end
Note: See TracBrowser for help on using the repository browser.