| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Usage:
 | 
| 4 | #   test/vagrant.sh <function name>
 | 
| 5 | 
 | 
| 6 | set -o nounset
 | 
| 7 | set -o pipefail
 | 
| 8 | set -o errexit
 | 
| 9 | 
 | 
| 10 | # TODO:
 | 
| 11 | # - FreeBSD - fix
 | 
| 12 | # - OpenBSD - no official image
 | 
| 13 | 
 | 
| 14 | # - 32-bit https://app.vagrantup.com/puppetlabs/boxes/ubuntu-16.04-32-puppet
 | 
| 15 | # Or a really old one:
 | 
| 16 | # - https://app.vagrantup.com/hashicorp/boxes/precise32
 | 
| 17 | 
 | 
| 18 | 
 | 
| 19 | # Hm lots of Ruby dependencies.
 | 
| 20 | install() {
 | 
| 21 |   sudo apt install vagrant
 | 
| 22 |   sudo apt install virtualbox
 | 
| 23 | }
 | 
| 24 | 
 | 
| 25 | # Downloads the image, run it, set up SSH stuff (keys, etc.).
 | 
| 26 | archlinux() {
 | 
| 27 |   # Hm does this only happen once per dir?
 | 
| 28 |   vagrant init archlinux/archlinux
 | 
| 29 |   vagrant up
 | 
| 30 | }
 | 
| 31 | 
 | 
| 32 | # vagrant ssh to log in.  ~/git/oil is mounted to /vagrant.  User is 'vagrant'.
 | 
| 33 | 
 | 
| 34 | # sudo pacman -S gcc make
 | 
| 35 | # Then untar ~/src/oil-$VERSION.tar.
 | 
| 36 | 
 | 
| 37 | 
 | 
| 38 | # centos/7
 | 
| 39 | # sudo yum install gcc make
 | 
| 40 | 
 | 
| 41 | # (NOTES: yum figures out the fastest mirror)
 | 
| 42 | 
 | 
| 43 | 
 | 
| 44 | # $ make
 | 
| 45 | # build/ovm-compile.sh build-opt _build/oil/ovm _build/oil/module_init.c _build/oil/main_name.c _build/oil/c-module-srcs.txt
 | 
| 46 | # ~/src/oil-0.1.alpha1/Python-2.7.13 ~/src/oil-0.1.alpha1
 | 
| 47 | # Modules/posixmodule.c:3914:21: fatal error: stropts.h: No such file or directory
 | 
| 48 | # #include <stropts.h>
 | 
| 49 | #                     ^
 | 
| 50 | # compilation terminated.
 | 
| 51 | # Modules/fcntlmodule.c:15:21: fatal error: stropts.h: No such file or directory
 | 
| 52 | #  #include <stropts.h>
 | 
| 53 | 
 | 
| 54 | "$@"
 |