| 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 virtual memory and virtual CPUs. | 
|---|
| 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 | dnf install -y glibc-locale-source glibc-langpack-${LANG%_*} | 
|---|
| 17 | localedef -v -c -i ${LANG%.*} -f UTF-8 $LANG 2>/dev/null | 
|---|
| 18 | localectl set-locale LANG=$LANG | 
|---|
| 19 | localectl set-keymap ${LANG%_*} | 
|---|
| 20 | localectl set-x11-keymap ${LANG%_*} | 
|---|
| 21 | # Update repositories. | 
|---|
| 22 | dnf install -y http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm | 
|---|
| 23 | # Install main dependencies. | 
|---|
| 24 | dnf install -y gcc-c++ debhelper dpkg-dev pyqt4-devel rpm-build subversion samba-winbind wine.i686 mingw32-wine-gecko wine-mono cabextract xar | 
|---|
| 25 | setsebool -P wine_mmap_zero_ignore=on mmap_low_allowed=on | 
|---|
| 26 | # Install desktop (XFCE) and GUI utils. | 
|---|
| 27 | dnf install -y @xfce-desktop-environment firefox VirtualBox-guest kmod-VirtualBox akmod-VirtualBox akmods | 
|---|
| 28 | systemctl set-default graphical.target | 
|---|
| 29 | sed -i '$d' /usr/lib/udev/rules.d/60-vboxguest.rules | 
|---|
| 30 | akmods && systemctl restart systemd-modules-load.service | 
|---|
| 31 | # Install ATOM editor by default (less disk space). | 
|---|
| 32 | wget -q https://atom.io/download/rpm -O /tmp/atom.rpm && dnf install -y /tmp/atom.rpm && rm -f /tmp/atom.rpm | 
|---|
| 33 | # Comment out next line if you prefer to install Eclipse IDE for Python (it needs more disk space). | 
|---|
| 34 | #dnf install -y eclipse-pydev eclipse-nls-${LANG%_*} | 
|---|
| 35 | # Download OGAgent environment installer. | 
|---|
| 36 | svn export https://opengnsys.es/svn/trunk/installer/ogagent-devel-installer.sh /home/vagrant | 
|---|
| 37 | # Instructions. | 
|---|
| 38 | echo "Manual operations:" | 
|---|
| 39 | echo "- Reboot VM or launch desktop: startxfce4 &" | 
|---|
| 40 | echo "- Enlarge VM window." | 
|---|
| 41 | echo "- To prepare OGAgent environment, execute: ./ogagent-devel-installer.sh" | 
|---|
| 42 | echo "- If you use the default Atom IDE:" | 
|---|
| 43 | echo "  - Open a Project located in /home/vagrant/ogagent/src directory." | 
|---|
| 44 | echo "- Only if you enable Eclipse IDE installation, you need to configure it before coding:" | 
|---|
| 45 | echo "  - Set Python interpreter on Preferences/PyDev/Interpreters/Python Interpreter." | 
|---|
| 46 | echo "  - Create a new PyDev Project located in /home/vagrant/ogagent/src directory." | 
|---|
| 47 | EOT | 
|---|
| 48 |  | 
|---|
| 49 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 
|---|
| 50 |  | 
|---|
| 51 |   # OpenGnsys boot-tools environment VM definition. | 
|---|
| 52 |   config.vm.define "ogAgent" do |ag| | 
|---|
| 53 |     ag.ssh.insert_key = false | 
|---|
| 54 |     # Specific VirtualBox configuration. | 
|---|
| 55 |     ag.vm.provider "virtualbox" do |vb| | 
|---|
| 56 |       # VM name, memory and CPUs. | 
|---|
| 57 |       vb.name = "ogAgent" | 
|---|
| 58 |       vb.memory = VMMEM | 
|---|
| 59 |       vb.cpus = VMCPUS | 
|---|
| 60 |       vb.gui = true | 
|---|
| 61 |     end | 
|---|
| 62 |     # VM base and host name. | 
|---|
| 63 |     ag.vm.box = "fedora/25-cloud-base" | 
|---|
| 64 |     ag.vm.hostname = "ogAgent" | 
|---|
| 65 |     # Comment to disable synced folder. | 
|---|
| 66 |     ag.vm.synced_folder ".", "/vagrant" | 
|---|
| 67 |     # Launch provisioning script. | 
|---|
| 68 |     ag.vm.provision "shell", inline: SCRIPT | 
|---|
| 69 |   end | 
|---|
| 70 |  | 
|---|
| 71 | end | 
|---|
| 72 |  | 
|---|