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,33 @@
1
+ #!/bin/sh
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
6
+
7
+ yum -y install \
8
+ ruby \
9
+ ruby-devel \
10
+ puppet \
11
+ rubygems \
12
+ rubygem-erubis \
13
+ rubygem-highline \
14
+ rubygem-json \
15
+ rubygem-mime-types \
16
+ rubygem-net-ssh \
17
+ rubygem-polyglot \
18
+ rubygem-rest-client \
19
+ rubygem-treetop \
20
+ rubygem-uuidtools
21
+
22
+ cd /tmp
23
+ wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
24
+ mount -o loop,ro VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
25
+ sh /mnt/VBoxLinuxAdditions.run
26
+ umount /mnt
27
+ rm VBoxGuestAdditions_$VBOX_VERSION.iso
28
+
29
+ gem install chef --no-rdoc --no-ri
30
+
31
+ exit
32
+
33
+ # EOF
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo "we made it to autorun"
@@ -0,0 +1,20 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1', :memory_size=> '256',
3
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
4
+ :os_type_id => 'Linux',
5
+ :iso_file => "systemrescuecd-x86-2.0.0.iso",
6
+ :iso_src => "http://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/2.0.0/systemrescuecd-x86-2.0.0.iso",
7
+ :iso_md5 => "51012e0bb943cff6367e5cea3a61cdbe",
8
+ :iso_download_timeout => "1000",
9
+ :boot_wait => "10", :boot_cmd_sequence => [
10
+ '<Tab> ',
11
+ 'setkmap=us dodhcp=eth0 dhcphostname=%NAME% ar_source=http://%IP%:%PORT%/ autoruns=0 rootpass=vagrant',
12
+ '<Enter>'
13
+ ],
14
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "autorun0",
15
+ :ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
16
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
17
+ :sudo_cmd => "sh '%f'",
18
+ :shutdown_cmd => "shutdown -H",
19
+ :postinstall_files => [ ], :postinstall_timeout => "10000"
20
+ })
@@ -0,0 +1,34 @@
1
+ # Archlinux AIF config file
2
+ # created by Dave Simons
3
+ # 11/07/2011
4
+
5
+ # install source
6
+ SOURCE=net
7
+ # use http mirrors only, ftp will time out
8
+ SYNC_URL=http://mirrors.kernel.org/archlinux/core/os/i686
9
+
10
+ # time/date
11
+ HARDWARECLOCK=localtime
12
+ TIMEZONE=Europe/Brussels
13
+
14
+ # packages to install
15
+ TARGET_GROUPS=base
16
+ TARGET_PACKAGES='sudo openssh vim ruby kernel26-headers make gcc glibc git perl net-tools'
17
+ TARGET_PACKAGES_EXCLUDE='nano emacs wpa_supplicant xfsprogs reiserfsprogs pcmciautils mdadm jfsutils cryptsetup lvm2'
18
+
19
+ # hard drive setup
20
+ GRUB_DEVICE='/dev/sda'
21
+ PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4'
22
+ BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params
23
+ /dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params
24
+ /dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'
25
+
26
+ worker_install_bootloader ()
27
+ {
28
+ cat << EOF > /mnt/boot/grub/device.map
29
+ (hd0) /dev/sda
30
+ EOF
31
+ grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1
32
+ bootdev=$(mount|grep $var_TARGET_DIR/boot|cut -d' ' -f1)
33
+ generate_grub_menulst || return 1
34
+ }
@@ -0,0 +1,29 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1', :memory_size=> '256',
3
+ :disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
4
+ :os_type_id => 'ArchLinux',
5
+ :iso_file => "archlinux-2010.05-netinstall-i686.iso",
6
+ :iso_src => "http://archlinux.mirror.kangaroot.net/iso/2010.05/archlinux-2010.05-netinstall-i686.iso",
7
+ :iso_md5 => "00df751d287d01821e0123c10056d020",
8
+ :iso_download_timeout => "1000",
9
+ :boot_wait => "5", :boot_cmd_sequence => [
10
+ '<Enter>',
11
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
12
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
13
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
14
+ 'root<Enter>',
15
+ 'dhcpcd eth0<Enter><Wait><Wait>',
16
+ 'echo "sshd: ALL" > /etc/hosts.allow<Enter>',
17
+ 'passwd<Enter>',
18
+ 'vagrant<Enter>',
19
+ 'vagrant<Enter>',
20
+ '/etc/rc.d/sshd start<Enter><Wait>',
21
+ 'sleep 3 && wget 10.0.2.2:7122/aif.cfg<Enter>',
22
+ ],
23
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "aif.cfg",
24
+ :ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
25
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
26
+ :sudo_cmd => "sh '%f'",
27
+ :shutdown_cmd => "shutdown -h now",
28
+ :postinstall_files => [ "postinstall.sh", "postinstall2.sh"], :postinstall_timeout => "10000"
29
+ })
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ # launch automated install
6
+ su -c 'aif -p automatic -c aif.cfg'
7
+
8
+ # copy over the vbox version file
9
+ /bin/cp -f /root/.vbox_version /mnt/root/.vbox_version
10
+
11
+ # chroot into the new system
12
+ mount -o bind /dev /mnt/dev
13
+ mount -o bind /sys /mnt/sys
14
+ mount -t proc none /mnt/proc
15
+ chroot /mnt <<ENDCHROOT
16
+
17
+ # make sure network is up and a nameserver is available
18
+ dhcpcd eth0
19
+
20
+ # sudo setup
21
+ # note: do not use tabs here, it autocompletes and borks the sudoers file
22
+ cat <<EOF > /etc/sudoers
23
+ root ALL=(ALL) ALL
24
+ %wheel ALL=(ALL) NOPASSWD: ALL
25
+ EOF
26
+
27
+ # set up user accounts
28
+ passwd<<EOF
29
+ vagrant
30
+ vagrant
31
+ EOF
32
+ useradd -m -G wheel -r vagrant
33
+ passwd -d vagrant
34
+ passwd vagrant<<EOF
35
+ vagrant
36
+ vagrant
37
+ EOF
38
+
39
+ # create puppet group
40
+ groupadd puppet
41
+
42
+ # make sure ssh is allowed
43
+ echo "sshd: ALL" > /etc/hosts.allow
44
+
45
+ # and everything else isn't
46
+ echo "ALL: ALL" > /etc/hosts.deny
47
+
48
+ # make sure sshd starts
49
+ sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
50
+
51
+ # install mitchellh's ssh key
52
+ mkdir /home/vagrant/.ssh
53
+ chmod 700 /home/vagrant/.ssh
54
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
55
+ chmod 600 /home/vagrant/.ssh/authorized_keys
56
+ chown -R vagrant /home/vagrant/.ssh
57
+
58
+ # choose a mirror
59
+ sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
60
+
61
+ # update pacman
62
+ pacman -Syy
63
+ pacman -S --noconfirm pacman
64
+
65
+ # upgrade pacman db
66
+ pacman-db-upgrade
67
+ pacman -Syy
68
+
69
+ # install some packages
70
+ pacman -S --noconfirm glibc git
71
+ gem install --no-ri --no-rdoc chef facter
72
+ cd /tmp
73
+ git clone https://github.com/puppetlabs/puppet.git
74
+ cd puppet
75
+ ruby install.rb --bindir=/usr/bin --sbindir=/sbin
76
+
77
+ # set up networking
78
+ sed -i 's/^\(interface=*\)/\1eth0/' /etc/rc.conf
79
+
80
+ # leave the chroot
81
+ ENDCHROOT
82
+
83
+ # take down network to prevent next postinstall.sh from starting too soon
84
+ /etc/rc.d/network stop
85
+
86
+ # and reboot!
87
+ reboot
@@ -0,0 +1,28 @@
1
+ # install virtualbox guest additions
2
+ VBOX_VERSION=$(cat /root/.vbox_version)
3
+ cd /tmp
4
+ wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso
5
+ mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt
6
+ sh /mnt/VBoxLinuxAdditions.run
7
+ umount /mnt
8
+ rm VBoxGuestAdditions_"$VBOX_VERSION".iso
9
+
10
+ # host-only networking
11
+ cat >> /etc/rc.local <<EOF
12
+ # enable DHCP at boot on eth0
13
+ # See https://wiki.archlinux.org/index.php/Network#DHCP_fails_at_boot
14
+ dhcpcd -k eth0
15
+ dhcpcd -nd eth0
16
+ EOF
17
+
18
+ # clean out pacman cache
19
+ pacman -Scc<<EOF
20
+ y
21
+ y
22
+ EOF
23
+
24
+ # zero out the fs
25
+ dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
26
+
27
+ # and the final reboot!
28
+ #reboot
@@ -0,0 +1,33 @@
1
+ # Archlinux AIF config file
2
+ # created by Dave Simons
3
+ # 11/07/2011
4
+
5
+ # install source
6
+ SOURCE=cd
7
+ FILE_URL=file:///src/core/pkg
8
+
9
+ # time/date
10
+ HARDWARECLOCK=localtime
11
+ TIMEZONE=Europe/Brussels
12
+
13
+ # packages to install
14
+ TARGET_GROUPS=base
15
+ TARGET_PACKAGES='sudo openssh vim ruby kernel26-headers make gcc'
16
+ TARGET_PACKAGES_EXCLUDE='nano emacs wpa_supplicant xfsprogs reiserfsprogs pcmciautils mdadm jfsutils cryptsetup lvm2'
17
+
18
+ # hard drive setup
19
+ GRUB_DEVICE='/dev/sda'
20
+ PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4'
21
+ BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params
22
+ /dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params
23
+ /dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'
24
+
25
+ worker_install_bootloader ()
26
+ {
27
+ cat << EOF > /mnt/boot/grub/device.map
28
+ (hd0) /dev/sda
29
+ EOF
30
+ grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1
31
+ bootdev=$(mount|grep $var_TARGET_DIR/boot|cut -d' ' -f1)
32
+ generate_grub_menulst || return 1
33
+ }
@@ -0,0 +1,29 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1', :memory_size=> '256',
3
+ :disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
4
+ :os_type_id => 'ArchLinux',
5
+ :iso_file => "archlinux-2010.05-core-i686.iso",
6
+ :iso_src => "http://archlinux.mirror.kangaroot.net/iso/2010.05/archlinux-2010.05-core-i686.iso",
7
+ :iso_md5 => "5db5fd11713635cff208b11a498c59ef",
8
+ :iso_download_timeout => "1000",
9
+ :boot_wait => "5", :boot_cmd_sequence => [
10
+ '<Enter>',
11
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
12
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
13
+ '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
14
+ 'root<Enter>',
15
+ 'dhcpcd eth0<Enter><Wait><Wait>',
16
+ 'echo "sshd: ALL" > /etc/hosts.allow<Enter>',
17
+ 'passwd<Enter>',
18
+ 'vagrant<Enter>',
19
+ 'vagrant<Enter>',
20
+ '/etc/rc.d/sshd start<Enter><Wait>',
21
+ 'sleep 3 && wget 10.0.2.2:7122/aif.cfg<Enter>',
22
+ ],
23
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "aif.cfg",
24
+ :ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
25
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
26
+ :sudo_cmd => "sh '%f'",
27
+ :shutdown_cmd => "shutdown -h now",
28
+ :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
29
+ })
@@ -0,0 +1,106 @@
1
+ #!/bin/bash
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ # launch automated install
6
+ su -c 'aif -p automatic -c aif.cfg'
7
+
8
+ # copy over the vbox version file
9
+ /bin/cp -f /root/.vbox_version /mnt/root/.vbox_version
10
+ VBOX_VERSION=$(cat /root/.vbox_version)
11
+
12
+ # chroot into the new system
13
+ mount -o bind /dev /mnt/dev
14
+ mount -o bind /sys /mnt/sys
15
+ mount -t proc none /mnt/proc
16
+ chroot /mnt <<ENDCHROOT
17
+
18
+ # make sure network is up and a nameserver is available
19
+ dhcpcd eth0
20
+
21
+ # sudo setup
22
+ # note: do not use tabs here, it autocompletes and borks the sudoers file
23
+ cat <<EOF > /etc/sudoers
24
+ root ALL=(ALL) ALL
25
+ %wheel ALL=(ALL) NOPASSWD: ALL
26
+ EOF
27
+
28
+ # set up user accounts
29
+ passwd<<EOF
30
+ vagrant
31
+ vagrant
32
+ EOF
33
+ useradd -m -G wheel -r vagrant
34
+ passwd -d vagrant
35
+ passwd vagrant<<EOF
36
+ vagrant
37
+ vagrant
38
+ EOF
39
+
40
+ # create puppet group
41
+ groupadd puppet
42
+
43
+ # make sure ssh is allowed
44
+ echo "sshd: ALL" > /etc/hosts.allow
45
+
46
+ # and everything else isn't
47
+ echo "ALL: ALL" > /etc/hosts.deny
48
+
49
+ # make sure sshd starts
50
+ sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
51
+
52
+ # install mitchellh's ssh key
53
+ mkdir /home/vagrant/.ssh
54
+ chmod 700 /home/vagrant/.ssh
55
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
56
+ chmod 600 /home/vagrant/.ssh/authorized_keys
57
+ chown -R vagrant /home/vagrant/.ssh
58
+
59
+ # choose a mirror
60
+ sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
61
+
62
+ # update pacman
63
+ pacman -Syy
64
+ pacman -S --noconfirm pacman
65
+
66
+ # upgrade pacman db
67
+ pacman-db-upgrade
68
+ pacman -Syy
69
+
70
+ # install some packages
71
+ pacman -S --noconfirm glibc git
72
+ gem install --no-ri --no-rdoc chef facter
73
+ cd /tmp
74
+ git clone https://github.com/puppetlabs/puppet.git
75
+ cd puppet
76
+ ruby install.rb --bindir=/usr/bin --sbindir=/sbin
77
+
78
+ # install virtualbox guest additions
79
+ cd /tmp
80
+ wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso
81
+ mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt
82
+ sh /mnt/VBoxLinuxAdditions.run
83
+ umount /mnt
84
+ rm VBoxGuestAdditions_"$VBOX_VERSION".iso
85
+
86
+ # host-only networking
87
+ cat <<EOF
88
+ # enable DHCP at boot on eth0
89
+ # See https://wiki.archlinux.org/index.php/Network#DHCP_fails_at_boot
90
+ dhcpcd -k eth0
91
+ dhcpcd -nd eth0
92
+ EOF >> /etc/rc.local
93
+
94
+ # clean out pacman cache
95
+ pacman -Scc<<EOF
96
+ y
97
+ y
98
+ EOF
99
+
100
+ # zero out the fs
101
+ dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
102
+
103
+ ENDCHROOT
104
+
105
+ # and reboot!
106
+ reboot
@@ -0,0 +1,34 @@
1
+ # Archlinux AIF config file
2
+ # created by Dave Simons
3
+ # 11/07/2011
4
+
5
+ # install source
6
+ SOURCE=net
7
+ # use http mirrors only, ftp will time out
8
+ SYNC_URL=http://mirrors.kernel.org/archlinux/core/os/x86_64
9
+
10
+ # time/date
11
+ HARDWARECLOCK=localtime
12
+ TIMEZONE=Europe/Brussels
13
+
14
+ # packages to install
15
+ TARGET_GROUPS=base
16
+ TARGET_PACKAGES='sudo openssh vim ruby kernel26-headers make gcc glibc git perl net-tools'
17
+ TARGET_PACKAGES_EXCLUDE='nano emacs wpa_supplicant xfsprogs reiserfsprogs pcmciautils mdadm jfsutils cryptsetup lvm2'
18
+
19
+ # hard drive setup
20
+ GRUB_DEVICE='/dev/sda'
21
+ PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4'
22
+ BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params
23
+ /dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params
24
+ /dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'
25
+
26
+ worker_install_bootloader ()
27
+ {
28
+ cat << EOF > /mnt/boot/grub/device.map
29
+ (hd0) /dev/sda
30
+ EOF
31
+ grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1
32
+ bootdev=$(mount|grep $var_TARGET_DIR/boot|cut -d' ' -f1)
33
+ generate_grub_menulst || return 1
34
+ }