Created
November 4, 2013 15:34
-
-
Save takumin/7304316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"type": "virtualbox", | |
"vm_name": "freebsd64-92r", | |
"boot_wait": "15s", | |
"disk_size": 4096, | |
"guest_os_type": "FreeBSD_64", | |
"iso_checksum": "cde180e3c5e3e370c97598a4feccb5b4", | |
"iso_checksum_type": "md5", | |
"iso_urls": [ | |
"http://ftp.jaist.ac.jp/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/9.2/FreeBSD-9.2-RELEASE-amd64-disc1.iso", | |
"http://ftp.sakura.ad.jp/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/9.2/FreeBSD-9.2-RELEASE-amd64-disc1.iso" | |
], | |
"ssh_username": "vagrant", | |
"ssh_password": "vagrant", | |
"shutdown_command": "echo 'shutdown -p now' | su -", | |
"vboxmanage": [ | |
[ "storageattach", "{{.Name}}", "--storagectl", "IDE Controller", "--port", "0", "--device", "0", "--type", "hdd", "--medium", "none" ], | |
[ "storagectl", "{{.Name}}", "--name", "SATA Controller", "--add", "sata", "--sataportcount", "1", "--hostiocache", "on" ], | |
[ "storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "0", "--device", "0", "--type", "hdd", "--medium", "output-virtualbox\\freebsd64-92r.vdi" ], | |
[ "modifyvm", "{{.Name}}", "--memory", "512" ], | |
[ "modifyvm", "{{.Name}}", "--cpus", "1" ], | |
[ "modifyvm", "{{.Name}}", "--nictype1", "virtio" ], | |
[ "modifyvm", "{{.Name}}", "--audio", "none" ], | |
[ "modifyvm", "{{.Name}}", "--usb", "off" ] | |
], | |
"http_directory": ".", | |
"boot_command": [ | |
"<enter><wait10><wait5>", | |
"l<enter><wait>", | |
"root<enter><wait>", | |
"dhclient vtnet0<enter><wait5>", | |
"fetch -o /tmp/install.sh http://{{.HTTPIP}}:{{.HTTPPort}}/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh {{.Name}}<enter>", | |
"<wait10><wait10><wait10><wait10><wait10><wait10>" | |
] | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"script": "postinstall.sh", | |
"override": { | |
"virtualbox": { | |
"execute_command": "cat '{{.Path}}' | su -" | |
} | |
} | |
} | |
], | |
"post-processors": [ | |
{ | |
"type": "vagrant", | |
"only": ["virtualbox"], | |
"output": "freebsd64-92r.box" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
NAME=$1 | |
gpart create -s gpt ada0 | |
gpart add -s 64k -t freebsd-boot -l boot ada0 | |
gpart add -s 1g -t freebsd-swap -l swap ada0 | |
gpart add -t freebsd-ufs -l disk ada0 | |
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0 | |
newfs -Ujl /dev/gpt/disk | |
mount /dev/gpt/disk /mnt | |
tar -xUpf /usr/freebsd-dist/base.txz -C /mnt | |
tar -xUpf /usr/freebsd-dist/kernel.txz -C /mnt | |
cat > /mnt/etc/fstab << __EOF__ | |
# Device Mountpoint FStype Options Dump Pass # | |
/dev/gpt/swap none swap sw 0 0 | |
/dev/gpt/disk / ufs rw 1 1 | |
procfs /proc procfs rw 0 0 | |
__EOF__ | |
sysrc -R /mnt hostname=${NAME} | |
sysrc -R /mnt ifconfig_DEFAULT=DHCP | |
chroot /mnt pw useradd -n vagrant -c "Vagrant User" -G wheel,operator -m -s /bin/csh -h - | |
echo -n "vagrant" | pw -V /mnt/etc usermod -n vagrant -h 0 | |
mkdir /mnt/home/vagrant/.ssh | |
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /mnt/home/vagrant/.ssh/authorized_keys | |
chmod 0700 /mnt/home/vagrant/.ssh | |
chown -R 1001:1001 /mnt/home/vagrant/.ssh | |
shutdown -r now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
rm /home/vagrant/*.iso | |
env ASSUME_ALWAYS_YES=yes pkg update -q | |
echo Install bash-static. | |
pkg install -qy bash-static | |
echo Install sudo. | |
pkg install -qy sudo | |
echo Install virtualbox-ose-additions. | |
pkg install -qy virtualbox-ose-additions | |
echo Install puppet-3.3.1_1 | |
pkg install -qy puppet-3.3.1_1 | |
echo Install rubygem-chef. | |
pkg install -qy rubygem-chef | |
sysrc vboxguest_enable=YES | |
sysrc vboxservice_enable=YES | |
sysrc vboxservice_flags=--disable-timesync | |
pw usermod vagrant -s /usr/local/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment