diff --git a/freebsd/Makefile b/freebsd/Makefile index b3e56ee..d8a819e 100644 --- a/freebsd/Makefile +++ b/freebsd/Makefile @@ -11,10 +11,10 @@ install-box-amd64-virtualbox: freebsd-amd64-virtualbox.box install-box-i386-virtualbox: freebsd-i386-virtualbox.box vagrant box add -f --name mcandre/freebsd-i386 --provider virtualbox freebsd-i386-virtualbox.box -freebsd-amd64-virtualbox.box: freebsd-amd64.json http/p *.sh Vagrantfile +freebsd-amd64-virtualbox.box: freebsd-amd64.json http/p-amd64 *.sh Vagrantfile PACKER_LOG=1 packer build -force -only virtualbox-iso freebsd-amd64.json -freebsd-i386-virtualbox.box: freebsd-i386.json http/p *.sh Vagrantfile +freebsd-i386-virtualbox.box: freebsd-i386.json http/p-i386 *.sh Vagrantfile PACKER_LOG=1 packer build -force -only virtualbox-iso freebsd-i386.json clean: clean-packer clean-boxes clean-vagrant clean-artifacts diff --git a/freebsd/freebsd-amd64.json b/freebsd/freebsd-amd64.json index 8620618..98ed34d 100644 --- a/freebsd/freebsd-amd64.json +++ b/freebsd/freebsd-amd64.json @@ -51,7 +51,7 @@ "", "mdmfs -s 100m md1 /tmp", "dhclient -p /tmp/dhclient.pid -l /tmp/dhclient.lease em0", - "fetch -o /tmp/p http://{{ .HTTPIP }}:{{ .HTTPPort }}/p", + "fetch -o /tmp/p http://{{ .HTTPIP }}:{{ .HTTPPort }}/p-amd64", "bsdinstall script /tmp/p", "", "reboot" diff --git a/freebsd/freebsd-i386.json b/freebsd/freebsd-i386.json index dc2124b..ca0f4f4 100644 --- a/freebsd/freebsd-i386.json +++ b/freebsd/freebsd-i386.json @@ -51,7 +51,7 @@ "", "mdmfs -s 100m md1 /tmp", "dhclient -p /tmp/dhclient.pid -l /tmp/dhclient.lease em0", - "fetch -o /tmp/p http://{{ .HTTPIP }}:{{ .HTTPPort }}/p", + "fetch -o /tmp/p http://{{ .HTTPIP }}:{{ .HTTPPort }}/p-i386", "bsdinstall script /tmp/p", "", "reboot" diff --git a/freebsd/http/p b/freebsd/http/p-amd64 similarity index 100% rename from freebsd/http/p rename to freebsd/http/p-amd64 diff --git a/freebsd/http/p-i386 b/freebsd/http/p-i386 new file mode 100644 index 0000000..929a18f --- /dev/null +++ b/freebsd/http/p-i386 @@ -0,0 +1,31 @@ +DISTRIBUTIONS="kernel.txz base.txz" + +for device in vtbd0 ada0 da0; do + if [ -e "/dev/${device}" ]; then + PARTITIONS="$device" + break + fi +done + +#!/bin/sh + +# Enable DHCP for default network adapter +echo 'nameserver 8.8.8.8' >/etc/resolv.conf && + adapter="$(ifconfig -l | cut -d' ' -f1)" && + sysrc "ifconfig_${adapter}"="dhcp" + +# Configure NTP +ASSUME_ALWAYS_YES=yes pkg update && + pkg install -y ntp && + sysrc ntpd_enable="YES" && + sysrc ntpdate_enable="YES" + +# Configure vagrant user for sudo +pkg install -y sudo && + echo 'vagrant' | pw useradd vagrant -h 0 -m && + pw group mod wheel -m vagrant && + echo 'Defaults:vagrant !requiretty' >>/usr/local/etc/sudoers && + echo '%wheel ALL=(ALL) NOPASSWD: ALL' >>/usr/local/etc/sudoers + +# Enable SSH server +sysrc sshd_enable="YES"