riot.json 4.97 KB
{
  "_comment": "Build with `packer build riot.json`",
  "builders": [
    {
      "boot_command": [
        "{{ user `boot_command_prefix` }}",
        "/install/vmlinuz noapic ",
        "initrd=/install/initrd.gz ",
        "file=/floppy/{{ user `preseed` }} ",
        "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
        "hostname={{ user `hostname` }} ",
        "fb=false debconf/frontend=noninteractive ",
        "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
        "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
        "passwd/user-fullname={{ user `ssh_fullname` }} ",
        "passwd/user-password={{ user `ssh_password` }} ",
        "passwd/user-password-again={{ user `ssh_password` }} ",
        "passwd/username={{ user `ssh_username` }} ",
        "-- <enter>"
      ],
      "disk_size": "{{ user `disk_size` }}",
      "floppy_files": [ "{{ user `preseed` }}" ],
      "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
      "guest_os_type": "{{ user `virtualbox_guest_os_type` }}",
      "headless": "{{ user `headless` }}",
      "iso_checksum": "{{ user `iso_checksum` }}",
      "iso_checksum_type": "{{ user `iso_checksum_type` }}",
      "iso_urls": [ "{{ user `iso_path` }}/{{ user `iso_name` }}", "{{ user `iso_url` }}" ],
      "output_directory": "output-{{ user `vm_name` }}-virtualbox-iso",
      "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
      "ssh_password": "{{ user `ssh_password` }}",
      "ssh_username": "{{ user `ssh_username` }}",
      "ssh_wait_timeout": "10000s",
      "type": "virtualbox-iso",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--memory", "{{ user `memory` }}" ],
        [ "modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}" ],
        [ "modifyvm", "{{.Name}}", "--usb", "on" ],
        [ "modifyvm", "{{.Name}}", "--usbxhci", "on" ],
        [ "modifyvm", "{{.Name}}", "--audio", "none"],
        [ "modifyvm", "{{.Name}}", "--ioapic", "on"],
        [ "modifyvm", "{{.Name}}", "--rtcuseutc", "on"],
        [ "modifyvm", "{{.Name}}", "--clipboard", "bidirectional"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "FTDI USB-TTL", "--vendorid", "0x0403", "--productid",  "0x6001"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "CP2102 USB to UART", "--vendorid", "0x10c4", "--productid",  "0xea60"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "STM32 STLink", "--vendorid", "0x0483", "--productid",  "0x3748"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "USBasp", "--vendorid", "0x16c0", "--productid",  "0x05dc"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "iotlab-m3", "--vendorid", "0x0403", "--productid",  "0x6010"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "samr21-xpro", "--vendorid", "0x03eb", "--productid",  "0x2111"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "Arduino Mega 2560", "--vendorid", "0x2341", "--productid",  "0x0042"],
        ["usbfilter", "add", "0", "--target", "{{.Name}}", "--name", "Phytec phyWAVE KW22", "--vendorid", "0x0d28", "--productid",  "0x0204"]
      ],
      "virtualbox_version_file": ".vbox_version",
      "vm_name": "{{user `vm_name`}}"
    }
  ],
  "post-processors": [
    [
      {
        "type": "vagrant",
        "keep_input_artifact": false,
        "output": "{{user `vm_name`}}_{{.Provider}}.box",
        "vagrantfile_template": "{{ user `vagrantfile_template` }}"
      }
    ]
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "./udev_rules",
      "destination": "/tmp"
    },
    {
      "environment_vars": [
        "SSH_USERNAME={{user `ssh_username`}}",
        "SSH_PASSWORD={{user `ssh_password`}}"
      ],
      "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
      "scripts": [ "setup.sh" ],
      "type": "shell"
    }
  ],
  "variables": {
    "boot_command_prefix": "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "cpus": "1",
    "disk_size": "65536",
    "headless": "true",
    "iso_checksum": "de5ee8665048f009577763efbf4a6f0558833e59",
    "iso_checksum_type": "sha1",
    "iso_name": "ubuntu-16.04.1-server-amd64.iso",
    "iso_path": "/Volumes/Storage/software/ubuntu",
    "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso",
    "memory": "512",
    "preseed" : "preseed.cfg",
    "hostname": "vagrant",
    "ssh_fullname": "vagrant",
    "ssh_password": "vagrant",
    "ssh_username": "vagrant",
    "vagrantfile_template": "vagrantfile.tpl",
    "virtualbox_guest_os_type": "Ubuntu_64",
    "vm_name": "RIOT-VM"
  }
}