vbox 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. data/.gitignore +14 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile.lock +68 -0
  4. data/README.md +5 -0
  5. data/Rakefile +91 -0
  6. data/bin/vbox +73 -0
  7. data/lib/java/README.txt +5 -0
  8. data/lib/java/dir2floppy.jar +0 -0
  9. data/lib/java/dir2floppy.java +134 -0
  10. data/lib/vagrant_init.rb +6 -0
  11. data/lib/vbox.rb +2 -0
  12. data/lib/vbox/command.rb +82 -0
  13. data/lib/vbox/config.rb +5 -0
  14. data/lib/vbox/export.rb +65 -0
  15. data/lib/vbox/scancode.rb +208 -0
  16. data/lib/vbox/session.rb +893 -0
  17. data/lib/vbox/shell.rb +54 -0
  18. data/lib/vbox/ssh.rb +193 -0
  19. data/lib/vbox/transaction.rb +122 -0
  20. data/lib/vbox/utils.rb +26 -0
  21. data/lib/vbox/version.rb +3 -0
  22. data/lib/vbox/web.rb +48 -0
  23. data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
  24. data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
  25. data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
  26. data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
  27. data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
  28. data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
  29. data/templates/CentOS-6.0-i386-netboot/definition.rb +16 -0
  30. data/templates/CentOS-6.0-i386-netboot/ks.cfg +52 -0
  31. data/templates/CentOS-6.0-i386-netboot/postinstall.sh +30 -0
  32. data/templates/CentOS-6.0-i386/definition.rb +17 -0
  33. data/templates/CentOS-6.0-i386/ks.cfg +47 -0
  34. data/templates/CentOS-6.0-i386/postinstall.sh +48 -0
  35. data/templates/CentOS-6.0-x86_64-netboot/definition.rb +16 -0
  36. data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +52 -0
  37. data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +30 -0
  38. data/templates/CentOS-6.0-x86_64/definition.rb +17 -0
  39. data/templates/CentOS-6.0-x86_64/ks.cfg +47 -0
  40. data/templates/CentOS-6.0-x86_64/postinstall.sh +48 -0
  41. data/templates/Debian-6.0.3-amd64-netboot/definition.rb +42 -0
  42. data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
  43. data/templates/Debian-6.0.3-amd64-netboot/preseed.cfg +42 -0
  44. data/templates/Debian-6.0.3-i386-netboot/definition.rb +44 -0
  45. data/templates/Debian-6.0.3-i386-netboot/postinstall.sh +80 -0
  46. data/templates/Debian-6.0.3-i386-netboot/preseed.cfg +42 -0
  47. data/templates/Fedora-15-i386-netboot/definition.rb +17 -0
  48. data/templates/Fedora-15-i386-netboot/ks.cfg +82 -0
  49. data/templates/Fedora-15-i386-netboot/postinstall.sh +18 -0
  50. data/templates/Fedora-15-i386/definition.rb +17 -0
  51. data/templates/Fedora-15-i386/ks.cfg +64 -0
  52. data/templates/Fedora-15-i386/postinstall.sh +33 -0
  53. data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
  54. data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
  55. data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
  56. data/templates/Fedora-15-x86_64/definition.rb +17 -0
  57. data/templates/Fedora-15-x86_64/ks.cfg +64 -0
  58. data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
  59. data/templates/Sysrescuecd-2.0.0-experimental/autorun0 +3 -0
  60. data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +20 -0
  61. data/templates/archlinux-i386-netboot/aif.cfg +34 -0
  62. data/templates/archlinux-i386-netboot/definition.rb +29 -0
  63. data/templates/archlinux-i386-netboot/postinstall.sh +87 -0
  64. data/templates/archlinux-i386-netboot/postinstall2.sh +28 -0
  65. data/templates/archlinux-i386/aif.cfg +33 -0
  66. data/templates/archlinux-i386/definition.rb +29 -0
  67. data/templates/archlinux-i386/postinstall.sh +106 -0
  68. data/templates/archlinux-x86_64-netboot/aif.cfg +34 -0
  69. data/templates/archlinux-x86_64-netboot/definition.rb +29 -0
  70. data/templates/archlinux-x86_64-netboot/postinstall.sh +90 -0
  71. data/templates/archlinux-x86_64-netboot/postinstall2.sh +28 -0
  72. data/templates/archlinux-x86_64/aif.cfg +33 -0
  73. data/templates/archlinux-x86_64/definition.rb +29 -0
  74. data/templates/archlinux-x86_64/postinstall.sh +90 -0
  75. data/templates/archlinux-x86_64/postinstall2.sh +38 -0
  76. data/templates/freebsd-8.2-experimental/definition.rb +19 -0
  77. data/templates/freebsd-8.2-experimental/postinstall.sh +191 -0
  78. data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +35 -0
  79. data/templates/freebsd-8.2-pcbsd-i386-netboot/pcinstall.fbg.cfg +58 -0
  80. data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +93 -0
  81. data/templates/freebsd-8.2-pcbsd-i386/definition.rb +31 -0
  82. data/templates/freebsd-8.2-pcbsd-i386/pcinstall.fbg.cfg +57 -0
  83. data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +93 -0
  84. data/templates/gentoo-latest-i386-experimental/definition.rb +29 -0
  85. data/templates/gentoo-latest-i386-experimental/postinstall.sh +184 -0
  86. data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
  87. data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
  88. data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
  89. data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
  90. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
  91. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
  92. data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
  93. data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
  94. data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
  95. data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
  96. data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
  97. data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
  98. data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
  99. data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
  100. data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
  101. data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
  102. data/templates/solaris-11-express-i386/auto_install/ai.dtd +58 -0
  103. data/templates/solaris-11-express-i386/auto_install/ai_manifest.xml +241 -0
  104. data/templates/solaris-11-express-i386/auto_install/configuration.dtd +44 -0
  105. data/templates/solaris-11-express-i386/auto_install/default.xml +124 -0
  106. data/templates/solaris-11-express-i386/auto_install/default.xml.orig +124 -0
  107. data/templates/solaris-11-express-i386/auto_install/sc_profiles/static_network.xml +105 -0
  108. data/templates/solaris-11-express-i386/auto_install/software.dtd +105 -0
  109. data/templates/solaris-11-express-i386/auto_install/target.dtd +196 -0
  110. data/templates/solaris-11-express-i386/default.xml +121 -0
  111. data/templates/solaris-11-express-i386/definition.rb +65 -0
  112. data/templates/solaris-11-express-i386/postinstall.sh +98 -0
  113. data/templates/ubuntu-10.04.3-server-amd64/definition.rb +54 -0
  114. data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +90 -0
  115. data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +87 -0
  116. data/templates/ubuntu-10.04.3-server-i386/definition.rb +24 -0
  117. data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +91 -0
  118. data/templates/ubuntu-10.04.3-server-i386/preseed.cfg +87 -0
  119. data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
  120. data/templates/ubuntu-11.10-server-amd64/postinstall.sh +90 -0
  121. data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
  122. data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
  123. data/templates/ubuntu-11.10-server-i386/postinstall.sh +90 -0
  124. data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
  125. data/validation/features/steps/ssh_steps.rb +169 -0
  126. data/validation/support/env.rb +1 -0
  127. data/validation/vagrant-private.key +27 -0
  128. data/validation/vagrant.feature +52 -0
  129. data/validation/vagrant.pub +1 -0
  130. data/vbox.gemspec +32 -0
  131. metadata +338 -0
@@ -0,0 +1,35 @@
1
+ # Many thanks to @draco2002
2
+ # http://dracosplace.com/veewee_and_freebsd
3
+
4
+ <<<<<<< HEAD
5
+ # :iso_src => "ftp://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-bootonly.iso",
6
+ # :iso_file => "PCBSD8.2-x86-bootonly.iso",
7
+
8
+ #Based on https://gist.github.com/911058
9
+
10
+ Veewee::Session.declare( {
11
+ :cpu_count => '1', :memory_size=> '768',
12
+ :disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
13
+ :os_type_id => 'FreeBSD',
14
+ :iso_file => "PCBSD8.2-x86-bootonly.iso",
15
+ :iso_src => "http://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-bootonly.iso",
16
+ :iso_md5 => "548646b9d1042a162f769bc280149417",
17
+ :iso_download_timeout => "1000",
18
+ :boot_wait => "70",:boot_cmd_sequence => [
19
+ '<KillX>',
20
+ '<Enter>',
21
+ 'dhclient em0<Enter>',
22
+ 'sleep 15;echo "Lets Get the File";fetch "http://%IP%:%PORT%/pcinstall.fbg.cfg";sleep 2;',
23
+ 'echo \'echo sshd_enable=\"YES\" >> $FSMNT/etc/rc.conf\' > /root/activate-ssh.sh ; cat /root/activate-ssh.sh<Enter>',
24
+ 'chmod +x /root/activate-ssh.sh<Enter>',
25
+ 'echo "Hope i got the file";/usr/PCBSD/pc-sysinstall/pc-sysinstall -c /root/pcinstall.fbg.cfg<Enter>',
26
+ 'reboot<Enter>'
27
+ ],
28
+ :kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "pcinstall.fbg.cfg",
29
+ :ssh_login_timeout => "10000",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
30
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
31
+ :sudo_cmd => "cat '%f'|su -",
32
+ :shutdown_cmd => "shutdown -p now",
33
+ :postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
34
+ }
35
+ )
@@ -0,0 +1,58 @@
1
+ installInteractive=no
2
+ installMode=fresh
3
+ installType=FreeBSD
4
+ packageType=tar
5
+ hostname=freebsd
6
+ #installMedium=dvd
7
+ ftpPath=ftp://ftp.pcbsd.org/pub/mirror/8.2/i386/netinstall/
8
+ installMedium=ftp
9
+ netSaveDev=AUTO-DHCP
10
+
11
+ # Timezone
12
+ timeZone=America/New_York
13
+ enableNTP=yes
14
+
15
+ # Keyboard Layout Options
16
+ localizeKeyModel=pc104
17
+ localizeKeyLayout=us U.S.
18
+
19
+ # Disk Setup for ada0
20
+ disk0=ada0
21
+ partition=ALL
22
+ bootManager=none
23
+ partscheme=MBR
24
+ commitDiskPart
25
+
26
+ # Setup the disk label
27
+ # All sizes are expressed in MB
28
+ disk0-part=UFS+S 1024 /
29
+ disk0-part=SWAP 1534 none
30
+ disk0-part=UFS+S 2048 /var
31
+ disk0-part=UFS+S 5529 /usr
32
+ commitDiskLabel
33
+
34
+ # List our components to install
35
+ # Src is only needed for the virtualbox extensions
36
+ # installComponents=ports,src
37
+ installComponents=ports
38
+
39
+ # Set the root pass
40
+ rootPass=vagrant
41
+
42
+ userName=vagrant
43
+ userComment=vagrant user
44
+ userPass=vagrant
45
+ userShell=/bin/csh
46
+ userHome=/home/vagrant
47
+ # Wheel group makes user sudo able
48
+ userGroups=wheel,operator
49
+ commitUser
50
+
51
+ runExtCommand=/root/activate-ssh.sh
52
+
53
+ # We temporary disable password checks , we promise to make up for it later
54
+ runCommand=sed -i -e 's@auth.*include.*system@@' /etc/pam.d/su
55
+
56
+ # making the clock run correctly
57
+ # http://forums.virtualbox.org/viewtopic.php?f=11&t=12210&start=0
58
+ # runCommand=echo 'kern.hz=100' > /boot/loader.conf
@@ -0,0 +1,93 @@
1
+ date > /etc/vagrant_box_build_time
2
+
3
+ # Get the latest portstree (needed for virtualbox to be on 4.x)
4
+ portsnap fetch update
5
+
6
+ #First install sudo
7
+ cd /usr/ports/security/sudo
8
+ make install -DBATCH
9
+
10
+ #We prefer bash to be there
11
+ cd /usr/ports/shells/bash
12
+ make install -DBATCH
13
+
14
+
15
+ #Off to rubygems to get first ruby running
16
+ cd /usr/ports/devel/ruby-gems
17
+ make install -DBATCH
18
+
19
+ #Gem chef - does install chef 9.12 (latest in ports?)
20
+ cd /usr/ports/sysutils/rubygem-chef
21
+ make install -DBATCH
22
+
23
+ #Installing chef & Puppet
24
+ /usr/local/bin/gem update chef --no-ri --no-rdoc
25
+ /usr/local/bin/gem install puppet --no-ri --no-rdoc
26
+
27
+ #Get wget
28
+ cd /usr/ports/ftp/wget
29
+ make install -DBATCH
30
+
31
+ #Installing vagrant keys
32
+ mkdir /home/vagrant/.ssh
33
+ chmod 700 /home/vagrant/.ssh
34
+ cd /home/vagrant/.ssh
35
+ /usr/local/bin/wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
36
+ chown -R vagrant /home/vagrant/.ssh
37
+
38
+ # Cleaning portstree to save space
39
+ # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html
40
+ cd /usr/ports/ports-mgmt/portupgrade
41
+ make install -DBATCH clean
42
+
43
+ /usr/local/sbin/portsclean -C
44
+
45
+ # As sharedfolders are not in defaults ports tree
46
+ # We will use vagrant via NFS
47
+ # Enable NFS
48
+ echo 'rpcbind_enable="YES"' >> /etc/rc.conf
49
+ echo 'nfs_server_enable="YES"' >> /etc/rc.conf
50
+ echo 'mountd_flags="-r"' >> /etc/rc.conf
51
+
52
+ # Enable passwordless sudo
53
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /usr/local/etc/sudoers
54
+ # Restore correct su permissions
55
+ # I'll leave that up to the reader :)
56
+
57
+ echo "=============================================================================="
58
+ echo "NOTE: FreeBSD - Vagrant"
59
+ echo "When using this basebox you need to do some special stuff in your Vagrantfile"
60
+ echo "1) Include the correct system"
61
+ echo " require 'vagrant/systems/freebsd' "
62
+ echo "2) Add after your config.vm.box = ..."
63
+ echo " config.vm.system = :freebsd"
64
+ echo "3) Enable HostOnly network"
65
+ echo " config.vm.network ...."
66
+ echo "4) Use nfs instead of shared folders"
67
+ echo " :nfs => true"
68
+ echo "============================================================================="
69
+
70
+
71
+
72
+ exit
73
+
74
+ # The iso from virtualbox will only install windows/solaris or linux, no BSD
75
+ # Research is on it's way to have 4.x in the main portstree
76
+ # http://www.listware.net/201102/freebsd-ports/65201-call-for-testers-virtualbox-404.html
77
+ # Virtualbox additions - http://wiki.freebsd.org/VirtualBox
78
+ # Currently this will only work for 4.0.4
79
+ cd /tmp
80
+ wget http://home.bluelife.at/ports/virtualbox-cft-20110218.tar.gz
81
+ cd /usr/ports
82
+ tar -xzvf /tmp/virtualbox-cft-20110218.tar.gz
83
+
84
+ # This requires libtool >= 2.4
85
+ cd /usr/ports/devel/libtool
86
+ make clean
87
+ make install -DBATCH
88
+
89
+ cd /usr/ports/emulators/virtualbox-ose-additions
90
+ make install -DBATCH
91
+
92
+ echo 'vboxguest_enable="YES"' >> /etc/rc.conf
93
+ echo 'vboxservice_enable="YES"' >> /etc/rc.conf
@@ -0,0 +1,31 @@
1
+ # Many thanks to @draco2002
2
+ # http://dracosplace.com/veewee_and_freebsd
3
+
4
+ # :iso_src => "ftp://mirrors.isc.org/pub/pcbsd/8.2/i386/PCBSD8.2-x86-bootonly.iso",
5
+ # :iso_file => "PCBSD8.2-x86-bootonly.iso",
6
+
7
+ Veewee::Session.declare({
8
+ :cpu_count => '1', :memory_size=> '768',
9
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
10
+ :os_type_id => 'FreeBSD',
11
+ :iso_file => "PCBSD8.2-x86-DVD.iso",
12
+ :iso_src => "http://mirror.xenserv.net/PC-BSD/8.2/i386/PCBSD8.2-x86-DVD.iso",
13
+ :iso_md5 => "6433a8abf6073b177750d48398bed341",
14
+ :iso_download_timeout => "1000",
15
+ :boot_wait => "70", :boot_cmd_sequence => [
16
+ '<KillX>',
17
+ '<Enter>',
18
+ 'dhclient em0<Enter>',
19
+ 'sleep 15;echo "Lets Get the File";fetch "http://%IP%:%PORT%/pcinstall.fbg.cfg";sleep 2;',
20
+ 'echo \'echo sshd_enable=\"YES\" >> $FSMNT/etc/rc.conf\' > /root/activate-ssh.sh ; cat /root/activate-ssh.sh<Enter>',
21
+ 'chmod +x /root/activate-ssh.sh<Enter>',
22
+ 'echo "Hope i got the file";/usr/PCBSD/pc-sysinstall/pc-sysinstall -c /root/pcinstall.fbg.cfg<Enter>',
23
+ 'reboot<Enter>'
24
+ ],
25
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "pcinstall.fbg.cfg",
26
+ :ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
27
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
28
+ :sudo_cmd => "cat '%f'|su -",
29
+ :shutdown_cmd => "shutdown -p now",
30
+ :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
31
+ })
@@ -0,0 +1,57 @@
1
+ installInteractive=no
2
+ installMode=fresh
3
+ installType=FreeBSD
4
+ packageType=tar
5
+ hostname=freebsd
6
+ #installMedium=dvd
7
+ installMedium=dvd
8
+ netSaveDev=AUTO-DHCP
9
+
10
+ # Timezone
11
+ timeZone=America/New_York
12
+ enableNTP=yes
13
+
14
+ # Keyboard Layout Options
15
+ localizeKeyModel=pc104
16
+ localizeKeyLayout=us U.S.
17
+
18
+ # Disk Setup for ada0
19
+ disk0=ada0
20
+ partition=ALL
21
+ bootManager=none
22
+ partscheme=MBR
23
+ commitDiskPart
24
+
25
+ # Setup the disk label
26
+ # All sizes are expressed in MB
27
+ disk0-part=UFS+S 1024 /
28
+ disk0-part=SWAP 1534 none
29
+ disk0-part=UFS+S 2048 /var
30
+ disk0-part=UFS+S 5529 /usr
31
+ commitDiskLabel
32
+
33
+ # List our components to install
34
+ # Src is only needed for the virtualbox extensions
35
+ # installComponents=ports,src
36
+ installComponents=ports
37
+
38
+ # Set the root pass
39
+ rootPass=vagrant
40
+
41
+ userName=vagrant
42
+ userComment=vagrant user
43
+ userPass=vagrant
44
+ userShell=/bin/csh
45
+ userHome=/home/vagrant
46
+ # Wheel group makes user sudo able
47
+ userGroups=wheel,operator
48
+ commitUser
49
+
50
+ runExtCommand=/root/activate-ssh.sh
51
+
52
+ # We temporary disable password checks , we promise to make up for it later
53
+ runCommand=sed -i -e 's@auth.*include.*system@@' /etc/pam.d/su
54
+
55
+ # making the clock run correctly
56
+ # http://forums.virtualbox.org/viewtopic.php?f=11&t=12210&start=0
57
+ # runCommand=echo 'kern.hz=100' > /boot/loader.conf
@@ -0,0 +1,93 @@
1
+ date > /etc/vagrant_box_build_time
2
+
3
+ # Get the latest portstree (needed for virtualbox to be on 4.x)
4
+ portsnap fetch update
5
+
6
+ #First install sudo
7
+ cd /usr/ports/security/sudo
8
+ make install -DBATCH
9
+
10
+ #We prefer bash to be there
11
+ cd /usr/ports/shells/bash
12
+ make install -DBATCH
13
+
14
+
15
+ #Off to rubygems to get first ruby running
16
+ cd /usr/ports/devel/ruby-gems
17
+ make install -DBATCH
18
+
19
+ #Gem chef - does install chef 9.12 (latest in ports?)
20
+ cd /usr/ports/sysutils/rubygem-chef
21
+ make install -DBATCH
22
+
23
+ #Installing chef & Puppet
24
+ /usr/local/bin/gem update chef --no-ri --no-rdoc
25
+ /usr/local/bin/gem install puppet --no-ri --no-rdoc
26
+
27
+ #Get wget
28
+ cd /usr/ports/ftp/wget
29
+ make install -DBATCH
30
+
31
+ #Installing vagrant keys
32
+ mkdir /home/vagrant/.ssh
33
+ chmod 700 /home/vagrant/.ssh
34
+ cd /home/vagrant/.ssh
35
+ /usr/local/bin/wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
36
+ chown -R vagrant /home/vagrant/.ssh
37
+
38
+ # Cleaning portstree to save space
39
+ # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html
40
+ cd /usr/ports/ports-mgmt/portupgrade
41
+ make install -DBATCH clean
42
+
43
+ /usr/local/sbin/portsclean -C
44
+
45
+ # As sharedfolders are not in defaults ports tree
46
+ # We will use vagrant via NFS
47
+ # Enable NFS
48
+ echo 'rpcbind_enable="YES"' >> /etc/rc.conf
49
+ echo 'nfs_server_enable="YES"' >> /etc/rc.conf
50
+ echo 'mountd_flags="-r"' >> /etc/rc.conf
51
+
52
+ # Enable passwordless sudo
53
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /usr/local/etc/sudoers
54
+ # Restore correct su permissions
55
+ # I'll leave that up to the reader :)
56
+
57
+ echo "=============================================================================="
58
+ echo "NOTE: FreeBSD - Vagrant"
59
+ echo "When using this basebox you need to do some special stuff in your Vagrantfile"
60
+ echo "1) Include the correct system"
61
+ echo " require 'vagrant/systems/freebsd' "
62
+ echo "2) Add after your config.vm.box = ..."
63
+ echo " config.vm.system = :freebsd"
64
+ echo "3) Enable HostOnly network"
65
+ echo " config.vm.network ...."
66
+ echo "4) Use nfs instead of shared folders"
67
+ echo " :nfs => true"
68
+ echo "============================================================================="
69
+
70
+
71
+
72
+ exit
73
+
74
+ # The iso from virtualbox will only install windows/solaris or linux, no BSD
75
+ # Research is on it's way to have 4.x in the main portstree
76
+ # http://www.listware.net/201102/freebsd-ports/65201-call-for-testers-virtualbox-404.html
77
+ # Virtualbox additions - http://wiki.freebsd.org/VirtualBox
78
+ # Currently this will only work for 4.0.4
79
+ cd /tmp
80
+ wget http://home.bluelife.at/ports/virtualbox-cft-20110218.tar.gz
81
+ cd /usr/ports
82
+ tar -xzvf /tmp/virtualbox-cft-20110218.tar.gz
83
+
84
+ # This requires libtool >= 2.4
85
+ cd /usr/ports/devel/libtool
86
+ make clean
87
+ make install -DBATCH
88
+
89
+ cd /usr/ports/emulators/virtualbox-ose-additions
90
+ make install -DBATCH
91
+
92
+ echo 'vboxguest_enable="YES"' >> /etc/rc.conf
93
+ echo 'vboxservice_enable="YES"' >> /etc/rc.conf
@@ -0,0 +1,29 @@
1
+ Veewee::Session.declare( {
2
+ :cpu_count => '1', :memory_size=> '768',
3
+ :disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
4
+ :os_type_id => 'Gentoo',
5
+ :iso_file => "install-x86-minimal-20110726.iso",
6
+ :iso_src => "http://ftp.halifax.rwth-aachen.de/gentoo/releases/x86/autobuilds/20110726/install-x86-minimal-20110726.iso"
7
+ :iso_md5 => "29fc74988e7f86417395e376afc1af47",
8
+ :iso_download_timeout => "1000",
9
+ :boot_wait => "120",:boot_cmd_sequence => [
10
+ 'net-setup eth0<Enter>',
11
+ '<Wait><Enter>',
12
+ '2<Enter>',
13
+ '1<Enter>',
14
+ '<Wait><Wait>ifconfig -a <Enter>',
15
+ #'sleep 5 ;curl http://%IP%:%PORT%/stages.sh -o stages.sh &&',
16
+ #'bash stages.sh &<Enter>',
17
+ 'passwd<Enter><Wait><Wait>',
18
+ 'vagrant<Enter><Wait>',
19
+ 'vagrant<Enter><Wait>',
20
+ '/etc/init.d/sshd start<Enter>'
21
+ ],
22
+ :kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "",
23
+ :ssh_login_timeout => "10000",:ssh_user => "root", :ssh_password => "vagrant",:ssh_key => "",
24
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
25
+ :sudo_cmd => "cat '%f'|su -",
26
+ :shutdown_cmd => "shutdown -p now",
27
+ :postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
28
+ }
29
+ )
@@ -0,0 +1,184 @@
1
+ #!/bin/bash
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ #Based on http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml
6
+
7
+ #Partition the disk
8
+ #This assumes a predefined layout - customize to your own liking
9
+
10
+ #/boot -> /dev/sda1
11
+ #swap -> /dev/sda2
12
+ #root -> /dev/sda3
13
+
14
+ sfdisk --force /dev/sda <<EOF
15
+ # partition table of /dev/sda
16
+ unit: sectors
17
+
18
+ /dev/sda1 : start= 2048, size= 409600, Id=83
19
+ /dev/sda2 : start= 411648, size= 2097152, Id=82
20
+ /dev/sda3 : start= 2508800, size= 18257920, Id=83
21
+ /dev/sda4 : start= 0, size= 0, Id= 0
22
+ EOF
23
+
24
+ sleep 2
25
+
26
+ #Format the /boot
27
+ mke2fs /dev/sda1
28
+
29
+ #Main partition /
30
+ mke2fs -j /dev/sda3
31
+
32
+ #Format the swap and use it
33
+ mkswap /dev/sda2
34
+ swapon /dev/sda2
35
+
36
+ #Mount the new disk
37
+ mkdir /mnt/gentoo
38
+ mount /dev/sda3 /mnt/gentoo
39
+ mkdir /mnt/gentoo/boot
40
+ mount /dev/sda1 /mnt/gentoo/boot
41
+ cd /mnt/gentoo
42
+
43
+ #Note: we retry as sometimes mirrors fail to have the files
44
+
45
+ #Download a stage3 archive
46
+ while true; do
47
+ wget ftp://distfiles.gentoo.org/gentoo/releases/x86/current-stage3/stage3-i686-*.tar.bz2 && > gotstage3
48
+ if [ -f "gotstage3" ]
49
+ then
50
+ break
51
+ else
52
+ echo "trying in 2seconds"
53
+ sleep 2
54
+ fi
55
+ done
56
+ tar xjpf stage3*
57
+
58
+ #Download Portage snapshot
59
+ cd /mnt/gentoo/usr
60
+ while true; do
61
+ wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2 && > gotportage
62
+ if [ -f "gotportage" ]
63
+ then
64
+ break
65
+ else
66
+ echo "trying in 2seconds"
67
+ sleep 2
68
+ fi
69
+ done
70
+
71
+ tar xjf portage-lat*
72
+
73
+ #Chroot
74
+ cd /
75
+ mount -t proc proc /mnt/gentoo/proc
76
+ mount --rbind /dev /mnt/gentoo/dev
77
+ cp -L /etc/resolv.conf /mnt/gentoo/etc/
78
+ echo "env-update && source /etc/profile" | chroot /mnt/gentoo /bin/bash -
79
+
80
+ # Get the kernel sources
81
+ echo "emerge gentoo-sources" | chroot /mnt/gentoo /bin/bash -
82
+
83
+ # We will use genkernel to automate the kernel compilation
84
+ # http://www.gentoo.org/doc/en/genkernel.xml
85
+ echo "emerge grub" | chroot /mnt/gentoo /bin/bash -
86
+ echo "emerge genkernel" | chroot /mnt/gentoo /bin/bash -
87
+ echo "genkernel --bootloader=grub --real_root=/dev/sda3 --no-splash --install all" | chroot /mnt/gentoo /bin/bash -
88
+
89
+ cat <<EOF | chroot /mnt/gentoo /bin/bash -
90
+ cat <<FSTAB > /etc/fstab
91
+ /dev/sda1 /boot ext2 noauto,noatime 1 2
92
+ /dev/sda3 / ext3 noatime 0 1
93
+ /dev/sda2 none swap sw 0 0
94
+ FSTAB
95
+ EOF
96
+
97
+
98
+ #We need some things to do here
99
+ #Network
100
+ cat <<EOF | chroot /mnt/gentoo /bin/bash -
101
+ cd /etc/conf.d
102
+ echo 'config_eth0=( "dhcp" )' >> net
103
+ #echo 'dhcpd_eth0=( "-t 10" )' >> net
104
+ #echo 'dhcp_eth0=( "release nodns nontp nois" )' >> net
105
+ rc-update add net.eth0 default
106
+ #Module?
107
+ rc-update add sshd default
108
+ EOF
109
+
110
+ #Root password
111
+
112
+ # Cron & Syslog
113
+ echo "emerge syslog-ng vixie-cron" | chroot /mnt/gentoo sh -
114
+ echo "rc-update add syslog-ng default" | chroot /mnt/gentoo sh -
115
+ echo "rc-update add vixie-cron default" | chroot /mnt/gentoo sh -
116
+
117
+ #Get an editor going
118
+ echo "emerge vim" | chroot /mnt/gentoo sh -
119
+
120
+ #Allow external ssh
121
+ echo "echo 'sshd:ALL' > /etc/hosts.allow" | chroot /mnt/gentoo sh -
122
+ echo "echo 'ALL:ALL' > /etc/hosts.deny" | chroot /mnt/gentoo sh -
123
+
124
+ #create vagrant user / password vagrant
125
+ chroot /mnt/gentoo useradd -m -r vagrant -p '$1$MPmczGP9$1SeNO4bw5YgiEJuo/ZkWq1'
126
+
127
+ #Configure Sudo
128
+ chroot /mnt/gentoo emerge sudo
129
+ echo "echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" | chroot /mnt/gentoo sh -
130
+
131
+ #Installing vagrant keys
132
+ chroot /mnt/gentoo emerge wget
133
+
134
+ echo "creating vagrant ssh keys"
135
+ chroot /mnt/gentoo mkdir /home/vagrant/.ssh
136
+ chroot /mnt/gentoo chmod 700 /home/vagrant/.ssh
137
+ chroot /mnt/gentoo cd /home/vagrant/.ssh
138
+ chroot /mnt/gentoo wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
139
+ chroot /mnt/gentoo chmod 600 /home/vagrant/.ssh/authorized_keys
140
+ chroot /mnt/gentoo chown -R vagrant /home/vagrant/.ssh
141
+
142
+ #This could be done in postinstall
143
+ #reboot
144
+
145
+ #get some ruby running
146
+ chroot /mnt/gentoo emerge git curl gcc automake m4
147
+ chroot /mnt/gentoo emerge libiconv readline zlib openssl curl git libyaml sqlite libxslt
148
+ echo "bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)"| chroot /mnt/gentoo /bin/bash -
149
+ echo "/usr/local/rvm/bin/rvm install ruby-1.8.7 "| chroot /mnt/gentoo sh -
150
+ echo "/usr/local/rvm/bin/rvm use ruby-1.8.7 --default "| chroot /mnt/gentoo sh -
151
+
152
+ #Installing chef & Puppet
153
+ echo ". /usr/local/rvm/scripts/rvm ; gem install chef --no-ri --no-rdoc"| chroot /mnt/gentoo sh -
154
+ echo ". /usr/local/rvm/scripts/rvm ; gem install puppet --no-ri --no-rdoc"| chroot /mnt/gentoo sh -
155
+
156
+
157
+ echo "adding rvm to global bash rc"
158
+ echo "echo '. /usr/local/rvm/scripts/rvm' >> /etc/bash/bash.rc" | chroot /mnt/gentoo sh -
159
+
160
+ /bin/cp -f /root/.vbox_version /mnt/gentoo/home/vagrant/.vbox_version
161
+ VBOX_VERSION=$(cat /root/.vbox_version)
162
+
163
+ #Kernel headers
164
+ chroot /mnt/gentoo emerge linux-headers
165
+
166
+ #Installing the virtualbox guest additions
167
+ cat <<EOF | chroot /mnt/gentoo /bin/bash -
168
+ cd /tmp
169
+ mkdir /mnt/vbox
170
+ wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
171
+ mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt/vbox
172
+ sh /mnt/vbox/VBoxLinuxAdditions.run
173
+ #umount /mnt/vbox
174
+ #rm VBoxGuestAdditions_$VBOX_VERSION.iso
175
+ EOF
176
+
177
+ echo "sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 rc.vboxadd):' /etc/rc.conf" | chroot /mnt/gentoo sh -
178
+
179
+ exit
180
+ cd /
181
+ umount /mnt/gentoo/{proc,sys,dev}
182
+ umount /mnt/gentoo
183
+
184
+ reboot