packer-cn/scripts/vagrant-freebsd-priv-config.sh
James Nugent 4fc0a1ea0a build: Allow multi-platform dev with Vagrantfile
This commit rewrites the Vagrantfile for Packer in a similar manner to
the work done for Nomad (hashicorp/nomad#3175) in order to make
cross-platform development easier. It also adds support for a FreeBSD
base box.

Provisioning scripts are separated out in order that they can be
correctly linted. Each script is prefixed `vagrant`, then the operating
system, then whether or not it expects to be run in a privileged shell.

Finally, dependencies have been bumped - Go 1.6 is switched out for the
latest (1.9.2).
2017-11-02 11:00:19 -07:00

36 lines
691 B
Bash
Executable File

#!/bin/sh
chown vagrant:wheel \
/opt/gopath \
/opt/gopath/src \
/opt/gopath/src/github.com \
/opt/gopath/src/github.com/hashicorp
mkdir -p /usr/local/etc/pkg/repos
cat <<EOT > /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/\${ABI}/latest"
}
EOT
pkg update
pkg install -y \
editors/vim-lite \
devel/git \
devel/gmake \
lang/go \
security/ca_root_nss \
shells/bash
chsh -s /usr/local/bin/bash vagrant
chsh -s /usr/local/bin/bash root
cat <<EOT >> /home/vagrant/.profile
export GOPATH=/opt/gopath
export PATH=\$GOPATH/bin:\$PATH
cd /opt/gopath/src/github.com/hashicorp/packer
EOT