summaryrefslogtreecommitdiffstats
path: root/installer/vagrant/Vagrantfile-ogagent-vbox
blob: 0b354bb76388c60da16636ee724881ec4a75352d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Vagrantfile to prepare virtual environment using VirtualBox provider to develop OGAgent.

VAGRANTFILE_API_VERSION = "2"
# VM provider: Oracle VM VirtualBox.
ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox"
# Language.
LANGUAGE = "es_ES"
ENV['LC_ALL'] = LANGUAGE + ".UTF-8"
# Amount of memory VM.
VMMEM = 4096
VMCPUS = 4
# OpenGnsys boot-tools environment provisioning script.
SCRIPT = <<EOT
# Set language.
export LANG="#{LANGUAGE}.UTF-8"
echo "LANG=\"$LANG\"" > /etc/default/locale
echo "LANG=\"$LANG\"" > /etc/environment
echo "LANGUAGE=\"$LANG\"" >> /etc/environment
echo "LC_ALL=\"$LANG\"" >> /etc/environment
echo "LC_CTYPE=\"$LANG\"" >> /etc/environment
locale-gen --lang #{LANGUAGE}
sed -i 's/XKBLAYOUT=.*/XKBLAYOUT="${LANG%_*}"/' /etc/default/keyboard
# Update repositories.
add-apt-repository -y ppa:webupd8team/java
add-apt-repository -y ppa:ubuntu-wine
dpkg --add-architecture i386 
apt-get update
apt-get -y upgrade
# Install main dependencies.
apt-get install -y aspell-${LANG%_*} debhelper dpkg-dev pyqt4-dev-tools realpath rpm subversion winbind wine1.8-i386
# Install desktop (XFCE) and GUI utils.
apt-get install -y xfce4 gnome-icon-theme-full tango-icon-theme firefox virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
echo "allowed_users=anybody" > /etc/X11/Xwrapper.config
# Install Oracle Java 8.
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
apt-get -y install oracle-java8-installer
# Install Eclipse Mars.
echo "Downloading Eclipse..."
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
tar -C /opt -xvzf /tmp/eclipse-php-mars-2-linux-gtk-x86_64.tar.gz
# Add Eclipse icon to the desktop.
mkdir -p /home/vagrant/Escritorio
echo "#!/usr/bin/env xdg-open" > /home/vagrant/Escritorio/eclipse.desktop
echo "[Desktop Entry]" >> /home/vagrant/Escritorio/eclipse.desktop
echo "Name=Eclipse" >> /home/vagrant/Escritorio/eclipse.desktop
echo "Type=Application" >> /home/vagrant/Escritorio/eclipse.desktop
echo "Exec=/opt/eclipse/eclipse" >> /home/vagrant/Escritorio/eclipse.desktop
echo "Icon=/opt/eclipse/icon.xpm" >> /home/vagrant/Escritorio/eclipse.desktop
echo "Terminal=false" >> /home/vagrant/Escritorio/eclipse.desktop
# Download OGAgent environment installer.
svn export http://opengnsys.es/svn/branches/version1.1-tickets/OGAgent-ticket718/installer/ogagent-devel-installer.sh /home/vagrant
# Instructions.
echo "Manual operations:"
echo "- Launch desktop: startxfce4 &"
echo "- Enlarge VM window."
echo "- To prepare OGAgent environment, execute: ./ogagent-devel-installer.sh"
echo "- Before modify OGAgent code, configure Eclipse:"
echo "  - Go to Eclipse Marketplace and install PyDev plug-in."
echo "  - Set Python interpreter on Preferences/PyDev/Interpreters/Python Interpreter."
echo "  - Create new PyDev Project located on /home/vagrant/ogagent/src directory."
EOT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # OpenGnsys boot-tools environment VM definition.
  config.vm.define "ogAgent" do |ag|
    # Specific VirtualBox configuration.
    ag.vm.provider "virtualbox" do |vb|
      # VM name, memory and CPUs.
      vb.name = "ogAgent"
      vb.memory = VMMEM
      vb.cpus = VMCPUS
      vb.gui = true
    end
    # VM base and host name.
    ag.vm.box = "ubuntu/trusty64"
    ag.vm.hostname = "ogAgent"
    # Disable synced folder.
    ag.vm.synced_folder ".", "/vagrant", disabled: true
    # Launch provisioning script.
    ag.vm.provision "shell", inline: SCRIPT
  end

end