Skip to content

Commit

Permalink
oeps, forget the netboot dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jedi4ever committed Apr 27, 2011
1 parent 8138646 commit cfb4936
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 0 deletions.
34 changes: 34 additions & 0 deletions templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Many thanks to @draco2002
# http://dracosplace.com/veewee_and_freebsd

# :iso_src => "ftp://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-bootonly.iso",
# :iso_file => "PCBSD8.2-x86-bootonly.iso",

#Based on https://gist.github.com/911058

Veewee::Session.declare( {
:cpu_count => '1', :memory_size=> '768',
:disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
:os_type_id => 'FreeBSD',
:iso_file => "PCBSD8.2-x86-bootonly.iso",
:iso_src => "http://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-bootonly.iso",
:iso_md5 => "548646b9d1042a162f769bc280149417",
:iso_download_timeout => "1000",
:boot_wait => "70",:boot_cmd_sequence => [
'<KillX>',
'<Enter>',
'dhclient em0<Enter>',
'sleep 15;echo "Lets Get the File";fetch "http://%IP%:%PORT%/pcinstall.fbg.cfg";sleep 2;',
'echo \'echo sshd_enable=\"YES\" >> $FSMNT/etc/rc.conf\' > /root/activate-ssh.sh ; cat /root/activate-ssh.sh<Enter>',
'chmod +x /root/activate-ssh.sh<Enter>',
'echo "Hope i got the file";/usr/PCBSD/pc-sysinstall/pc-sysinstall -c /root/pcinstall.fbg.cfg<Enter>',
'reboot<Enter>'
],
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "pcinstall.fbg.cfg",
:ssh_login_timeout => "10000",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "cat '%f'|su -",
:shutdown_cmd => "shutdown -p now",
:postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
}
)
58 changes: 58 additions & 0 deletions templates/freebsd-8.2-pcbsd-i386-netboot/pcinstall.fbg.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
installInteractive=no
installMode=fresh
installType=FreeBSD
packageType=tar
hostname=freebsd
#installMedium=dvd
ftpPath=ftp://ftp.pcbsd.org/pub/mirror/8.2/i386/netinstall/
installMedium=ftp
netSaveDev=AUTO-DHCP

# Timezone
timeZone=America/New_York
enableNTP=yes

# Keyboard Layout Options
localizeKeyModel=pc104
localizeKeyLayout=us U.S.

# Disk Setup for ada0
disk0=ada0
partition=ALL
bootManager=none
partscheme=MBR
commitDiskPart

# Setup the disk label
# All sizes are expressed in MB
disk0-part=UFS+S 1024 /
disk0-part=SWAP 1534 none
disk0-part=UFS+S 2048 /var
disk0-part=UFS+S 5529 /usr
commitDiskLabel

# List our components to install
# Src is only needed for the virtualbox extensions
# installComponents=ports,src
installComponents=ports

# Set the root pass
rootPass=vagrant

userName=vagrant
userComment=vagrant user
userPass=vagrant
userShell=/bin/csh
userHome=/home/vagrant
# Wheel group makes user sudo able
userGroups=wheel,operator
commitUser

runExtCommand=/root/activate-ssh.sh

# We temporary disable password checks , we promise to make up for it later
runCommand=sed -i -e 's@auth.*include.*system@@' /etc/pam.d/su

# making the clock run correctly
# http://forums.virtualbox.org/viewtopic.php?f=11&t=12210&start=0
# runCommand=echo 'kern.hz=100' > /boot/loader.conf
91 changes: 91 additions & 0 deletions templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Get the latest portstree (needed for virtualbox to be on 4.x)
portsnap fetch update

#First install sudo
cd /usr/ports/security/sudo
make install -DBATCH

#We prefer bash to be there
cd /usr/ports/shells/bash
make install -DBATCH


#Off to rubygems to get first ruby running
cd /usr/ports/devel/ruby-gems
make install -DBATCH

#Gem chef - does install chef 9.12 (latest in ports?)
cd /usr/ports/sysutils/rubygem-chef
make install -DBATCH

#Installing chef & Puppet
/usr/local/bin/gem update chef --no-ri --no-rdoc
/usr/local/bin/gem install puppet --no-ri --no-rdoc

#Get wget
cd /usr/ports/ftp/wget
make install -DBATCH

#Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
/usr/local/bin/wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh

# Cleaning portstree to save space
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html
cd /usr/ports/ports-mgmt/portupgrade
make install -DBATCH clean

/usr/local/sbin/portsclean -C

# As sharedfolders are not in defaults ports tree
# We will use vagrant via NFS
# Enable NFS
echo 'rpcbind_enable="YES"' >> /etc/rc.conf
echo 'nfs_server_enable="YES"' >> /etc/rc.conf
echo 'mountd_flags="-r"' >> /etc/rc.conf

# Enable passwordless sudo
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /usr/local/etc/sudoers
# Restore correct su permissions
# I'll leave that up to the reader :)

echo "=============================================================================="
echo "NOTE: FreeBSD - Vagrant"
echo "When using this basebox you need to do some special stuff in your Vagrantfile"
echo "1) Include the correct system"
echo " require 'vagrant/systems/freebsd' "
echo "2) Add after your config.vm.box = ..."
echo " config.vm.system = :freebsd"
echo "3) Enable HostOnly network"
echo " config.vm.network ...."
echo "4) Use nfs instead of shared folders"
echo " :nfs => true"
echo "============================================================================="



exit

# The iso from virtualbox will only install windows/solaris or linux, no BSD
# Research is on it's way to have 4.x in the main portstree
# http://www.listware.net/201102/freebsd-ports/65201-call-for-testers-virtualbox-404.html
# Virtualbox additions - http://wiki.freebsd.org/VirtualBox
# Currently this will only work for 4.0.4
cd /tmp
wget http://home.bluelife.at/ports/virtualbox-cft-20110218.tar.gz
cd /usr/ports
tar -xzvf /tmp/virtualbox-cft-20110218.tar.gz

# This requires libtool >= 2.4
cd /usr/ports/devel/libtool
make clean
make install -DBATCH

cd /usr/ports/emulators/virtualbox-ose-additions
make install -DBATCH

echo 'vboxguest_enable="YES"' >> /etc/rc.conf
echo 'vboxservice_enable="YES"' >> /etc/rc.conf

0 comments on commit cfb4936

Please sign in to comment.