| 1 | # Vagrantfile to install OpenGnsys boot-tools .1 virtual environment using VirtualBox provider. | 
|---|
| 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. | 
|---|
| 10 | VMMEM = 1024 | 
|---|
| 11 | # OpenGnsys boot-tools environment provisioning script. | 
|---|
| 12 | SCRIPT = <<EOT | 
|---|
| 13 | # Set language. | 
|---|
| 14 | export LANG="#{LANGUAGE}.UTF-8" | 
|---|
| 15 | echo "LANG=\"$LANG\"" > /etc/default/locale | 
|---|
| 16 | echo "LANG=\"$LANG\"" >> /etc/environment | 
|---|
| 17 | locale-gen --lang #{LANGUAGE} | 
|---|
| 18 | sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard | 
|---|
| 19 | dpkg-reconfigure -fnoninteractive console-setup | 
|---|
| 20 | # Install dependencies. | 
|---|
| 21 | apt-get update -y | 
|---|
| 22 | apt-get install -y subversion | 
|---|
| 23 | # Prepare environment. | 
|---|
| 24 | groupadd opengnsys | 
|---|
| 25 | mkdir -p /opt/opengnsys/client /tmp/opengnsys_installer/opengnsys | 
|---|
| 26 | ln -fs /var/lib/tftpboot /opt/opengnsys | 
|---|
| 27 | svn export https://opengnsys.es/svn/trunk/client /tmp/opengnsys_installer/opengnsys/client | 
|---|
| 28 | echo "Connect to this VM, launch boot-tools generation script and follow instructions:" | 
|---|
| 29 | echo "    sudo /tmp/opengnsys_installer/opengnsys/client/boot-tools/boottoolsgenerator.sh" | 
|---|
| 30 | echo "Warning: this process may take a long time." | 
|---|
| 31 | echo "ogLive ISO file will be located in /opt/opengnsys/tftpboot/ogclient directory." | 
|---|
| 32 | EOT | 
|---|
| 33 |  | 
|---|
| 34 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 
|---|
| 35 |  | 
|---|
| 36 |   # OpenGnsys boot-tools environment VM definition. | 
|---|
| 37 |   config.vm.define "ogBootTools" do |bt| | 
|---|
| 38 |     # Specific VirtualBox configuration. | 
|---|
| 39 |     bt.vm.provider "virtualbox" do |vb| | 
|---|
| 40 |       # VM name, memory and CPUs. | 
|---|
| 41 |       vb.name = "ogBootTools" | 
|---|
| 42 |       vb.memory = VMMEM | 
|---|
| 43 |       vb.cpus = 1 | 
|---|
| 44 |     end | 
|---|
| 45 |     # VM base and host name. | 
|---|
| 46 |     bt.vm.box = "ubuntu/xenial64" | 
|---|
| 47 |     bt.vm.hostname = "ogBootTools" | 
|---|
| 48 |     # Comment out to disable synced folder. | 
|---|
| 49 |     #bt.vm.synced_folder ".", "/vagrant", disabled: true | 
|---|
| 50 |     # Launch provisioning script. | 
|---|
| 51 |     bt.vm.provision "shell", inline: SCRIPT | 
|---|
| 52 |   end | 
|---|
| 53 |  | 
|---|
| 54 | end | 
|---|
| 55 |  | 
|---|