1 | # Vagrantfile to prepare virtual environment using VirtualBox provider to develop OGAgent. |
---|
2 | |
---|
3 | VAGRANTFILE_API_VERSION = "2" |
---|
4 | # VM provider: Oracle VM VirtualBox. |
---|
5 | ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" |
---|
6 | # Language. |
---|
7 | LANGUAGE = "es_ES" |
---|
8 | ENV['LC_ALL'] = LANGUAGE + ".UTF-8" |
---|
9 | # Amount of memory VM. |
---|
10 | VMMEM = 4096 |
---|
11 | VMCPUS = 4 |
---|
12 | # OpenGnsys boot-tools environment provisioning script. |
---|
13 | SCRIPT = <<EOT |
---|
14 | # Set language. |
---|
15 | export LANG="#{LANGUAGE}.UTF-8" |
---|
16 | echo "LANG=\"$LANG\"" > /etc/default/locale |
---|
17 | echo "LANG=\"$LANG\"" >> /etc/environment |
---|
18 | echo "LANGUAGE=\"$LANG\"" >> /etc/environment |
---|
19 | echo "LC_ALL=\"$LANG\"" >> /etc/environment |
---|
20 | echo "LC_CTYPE=\"$LANG\"" >> /etc/environment |
---|
21 | locale-gen --lang #{LANGUAGE} |
---|
22 | sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard |
---|
23 | # Update repositories. |
---|
24 | add-apt-repository -y ppa:webupd8team/java |
---|
25 | add-apt-repository -y ppa:ubuntu-wine |
---|
26 | dpkg --add-architecture i386 |
---|
27 | apt-get update |
---|
28 | apt-get -y upgrade |
---|
29 | # Install main dependencies. |
---|
30 | apt-get install -y aspell-${LANG%_*} debhelper dpkg-dev pyqt4-dev-tools realpath rpm subversion winbind wine1.8-i386 |
---|
31 | # Install desktop (XFCE) and GUI utils. |
---|
32 | apt-get install -y xfce4 gnome-icon-theme-full tango-icon-theme firefox virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 |
---|
33 | echo "allowed_users=anybody" > /etc/X11/Xwrapper.config |
---|
34 | # Install Oracle Java 8. |
---|
35 | echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections |
---|
36 | echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections |
---|
37 | apt-get -y install oracle-java8-installer |
---|
38 | # Install Eclipse Mars. |
---|
39 | echo "Downloading Eclipse..." |
---|
40 | wget -q http://ftp.fau.de/eclipse/technology/epp/downloads/release/mars/2/eclipse-php-mars-2-linux-gtk-x86_64.tar.gz -O /tmp/eclipse-php-mars-2-linux-gtk-x86_64.tar.gz |
---|
41 | tar -C /opt -xvzf /tmp/eclipse-php-mars-2-linux-gtk-x86_64.tar.gz |
---|
42 | # Add Eclipse icon to the desktop. |
---|
43 | mkdir -p /home/vagrant/Escritorio |
---|
44 | mkdir -p /home/vagrant/Escritorio |
---|
45 | echo "#!/usr/bin/env xdg-open" > /home/vagrant/Escritorio/eclipse.desktop |
---|
46 | echo "[Desktop Entry]" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
47 | echo "Name=Eclipse" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
48 | echo "Type=Application" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
49 | echo "Exec=/opt/eclipse/eclipse" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
50 | echo "Icon=/opt/eclipse/icon.xpm" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
51 | echo "Terminal=false" >> /home/vagrant/Escritorio/eclipse.desktop |
---|
52 | chown -R vagrant.vagrant /home/vagrant/Escritorio |
---|
53 | # Download OGAgent environment installer. |
---|
54 | svn export http://opengnsys.es/svn/branches/version1.1/installer/ogagent-devel-installer.sh /home/vagrant |
---|
55 | # Instructions. |
---|
56 | echo "Manual operations:" |
---|
57 | echo "- Launch desktop: startxfce4 &" |
---|
58 | echo "- Enlarge VM window." |
---|
59 | echo "- To prepare OGAgent environment, execute: ./ogagent-devel-installer.sh" |
---|
60 | echo "- Before modify OGAgent code, configure Eclipse:" |
---|
61 | echo " - Go to Eclipse Marketplace and install PyDev plug-in." |
---|
62 | echo " - Set Python interpreter on Preferences/PyDev/Interpreters/Python Interpreter." |
---|
63 | echo " - Create new PyDev Project located on /home/vagrant/ogagent/src directory." |
---|
64 | EOT |
---|
65 | |
---|
66 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
---|
67 | |
---|
68 | # OpenGnsys boot-tools environment VM definition. |
---|
69 | config.vm.define "ogAgent" do |ag| |
---|
70 | # Specific VirtualBox configuration. |
---|
71 | ag.vm.provider "virtualbox" do |vb| |
---|
72 | # VM name, memory and CPUs. |
---|
73 | vb.name = "ogAgent" |
---|
74 | vb.memory = VMMEM |
---|
75 | vb.cpus = VMCPUS |
---|
76 | vb.gui = true |
---|
77 | end |
---|
78 | # VM base and host name. |
---|
79 | ag.vm.box = "ubuntu/trusty64" |
---|
80 | ag.vm.hostname = "ogAgent" |
---|
81 | # Disable synced folder. |
---|
82 | ag.vm.synced_folder ".", "/vagrant", disabled: true |
---|
83 | # Launch provisioning script. |
---|
84 | ag.vm.provision "shell", inline: SCRIPT |
---|
85 | end |
---|
86 | |
---|
87 | end |
---|
88 | |
---|