veewee 0.1.29 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/Gemfile.lock +23 -29
  2. data/lib/veewee/session.rb +10 -7
  3. data/lib/veewee/ssh.rb +70 -42
  4. data/lib/veewee/version.rb +1 -1
  5. data/templates/CentOS-4.8-i386/postinstall.sh +2 -0
  6. data/templates/CentOS-5.6-i386-netboot/postinstall.sh +3 -1
  7. data/templates/CentOS-5.6-i386/postinstall.sh +3 -1
  8. data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +2 -0
  9. data/templates/CentOS-6.0-i386-netboot/definition.rb +16 -0
  10. data/templates/CentOS-6.0-i386-netboot/ks.cfg +52 -0
  11. data/templates/CentOS-6.0-i386-netboot/postinstall.sh +30 -0
  12. data/templates/CentOS-6.0-i386/definition.rb +17 -0
  13. data/templates/CentOS-6.0-i386/ks.cfg +47 -0
  14. data/templates/CentOS-6.0-i386/postinstall.sh +48 -0
  15. data/templates/CentOS-6.0-x86_64-netboot/definition.rb +16 -0
  16. data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +52 -0
  17. data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +30 -0
  18. data/templates/CentOS-6.0-x86_64/definition.rb +17 -0
  19. data/templates/CentOS-6.0-x86_64/ks.cfg +47 -0
  20. data/templates/CentOS-6.0-x86_64/postinstall.sh +48 -0
  21. data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +2 -0
  22. data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +2 -0
  23. data/templates/Debian-6.0.2-amd64-netboot/postinstall.sh +2 -0
  24. data/templates/Debian-6.0.2-i386-netboot/postinstall.sh +2 -0
  25. data/templates/Fedora-14-amd64-netboot/postinstall.sh +2 -0
  26. data/templates/Fedora-14-amd64/postinstall.sh +2 -0
  27. data/templates/Fedora-14-i386-netboot/postinstall.sh +2 -0
  28. data/templates/Fedora-14-i386/postinstall.sh +2 -0
  29. data/templates/Fedora-15-i386-netboot/definition.rb +17 -0
  30. data/templates/Fedora-15-i386-netboot/ks.cfg +82 -0
  31. data/templates/Fedora-15-i386-netboot/postinstall.sh +18 -0
  32. data/templates/Fedora-15-i386/definition.rb +17 -0
  33. data/templates/Fedora-15-i386/ks.cfg +64 -0
  34. data/templates/Fedora-15-i386/postinstall.sh +33 -0
  35. data/templates/archlinux-i386/aif.cfg +33 -0
  36. data/templates/archlinux-i386/definition.rb +29 -0
  37. data/templates/archlinux-i386/postinstall.sh +95 -0
  38. data/templates/archlinux-x86_64/aif.cfg +33 -0
  39. data/templates/{archlinux-64-aif-experimental → archlinux-x86_64}/definition.rb +7 -7
  40. data/templates/archlinux-x86_64/postinstall.sh +95 -0
  41. data/templates/freebsd-8.2-experimental/postinstall.sh +3 -1
  42. data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +2 -0
  43. data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +2 -0
  44. data/templates/gentoo-latest-i386-experimental/postinstall.sh +2 -0
  45. data/templates/openindiana-148-ai-x86/postinstall.sh +2 -0
  46. data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -0
  47. data/templates/solaris-11-express-i386/postinstall.sh +2 -0
  48. data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +4 -2
  49. data/templates/ubuntu-10.04.2-server-amd64-alt/definition.rb +57 -0
  50. data/templates/ubuntu-10.04.2-server-amd64-alt/postinstall.sh +249 -0
  51. data/templates/ubuntu-10.04.2-server-amd64-alt/preseed.cfg +124 -0
  52. data/templates/ubuntu-10.04.2-server-amd64/definition.rb +56 -23
  53. data/templates/ubuntu-10.04.2-server-amd64/postinstall.sh +4 -2
  54. data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +4 -2
  55. data/templates/ubuntu-10.04.2-server-i386/postinstall.sh +3 -1
  56. data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +4 -2
  57. data/templates/ubuntu-10.10-server-amd64/postinstall.sh +3 -1
  58. data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +4 -2
  59. data/templates/ubuntu-10.10-server-i386/postinstall.sh +4 -2
  60. data/templates/ubuntu-11.04-server-amd64/postinstall.sh +4 -2
  61. data/templates/ubuntu-11.04-server-i386/postinstall.sh +4 -2
  62. data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +2 -0
  63. data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +3 -1
  64. data/validation/features/steps/ssh_steps.rb +22 -8
  65. data/veewee.gemspec +2 -2
  66. metadata +40 -21
  67. data/templates/archlinux-64-aif-experimental/postinstall.sh +0 -6
  68. data/templates/archlinux-64-experimental/autorun0 +0 -6
  69. data/templates/archlinux-64-experimental/definition.rb +0 -21
  70. data/templates/archlinux-64-experimental/postinstall.sh +0 -190
  71. data/templates/archlinux-i686/autorun0 +0 -6
  72. data/templates/archlinux-i686/definition.rb +0 -21
  73. data/templates/archlinux-i686/postinstall.sh +0 -191
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ # Install VirtualBox extensions.
6
+
7
+ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
8
+
9
+ cd /tmp
10
+ wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
11
+ mount -o loop,ro VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
12
+ sh /mnt/VBoxLinuxAdditions.run
13
+ umount /mnt
14
+ rm VBoxGuestAdditions_$VBOX_VERSION.iso
15
+
16
+ exit 0
17
+
18
+ # EOF
@@ -0,0 +1,17 @@
1
+ Veewee::Session.declare({
2
+ # Minimum RAM requirement for installation is 640MB.
3
+ :cpu_count => '1', :memory_size=> '640',
4
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :hwvirtext => 'on',
5
+ :os_type_id => 'Fedora',
6
+ :iso_file => "Fedora-15-i386-DVD.iso",
7
+ :iso_src => "http://download.fedoraproject.org/pub/fedora/linux/releases/15/Fedora/i386/iso/Fedora-15-i386-DVD.iso",
8
+ :iso_md5 => "eea96f0d780687a73fdbc78137b38584",
9
+ :iso_download_timeout => 1000,
10
+ :boot_wait => "10", :boot_cmd_sequence => [ '<Tab> linux text ks=http://%IP%:%PORT%/ks.cfg<Enter><Enter>' ],
11
+ :kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
12
+ :ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
13
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
14
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
15
+ :shutdown_cmd => "/sbin/halt -h -p",
16
+ :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
17
+ })
@@ -0,0 +1,64 @@
1
+ # Kickstart file automatically generated by anaconda.
2
+
3
+ install
4
+ cdrom
5
+ lang en_US.UTF-8
6
+ keyboard us
7
+ network --onboot yes --device p2p1 --bootproto dhcp --noipv6
8
+ timezone --utc America/Los_Angeles
9
+ rootpw --iscrypted $6$n/NGsk5H2aiBMXL4$r/oPkJtB5rasvQHPo9AvIJBe6sNVlQbpZxvTRMN7.qZk/Sn9u2qZ0XgNxflUvK20y7OIWdr/vv7MED6gzkBiH0
10
+ selinux --enforcing
11
+ authconfig --enableshadow --passalgo=sha512
12
+ firewall --service=ssh
13
+ # The following is the partition information you requested
14
+ # Note that any partitions you deleted are not expressed
15
+ # here so unless you clear all partitions first, this is
16
+ # not guaranteed to work
17
+ clearpart --all --drives=sda --initlabel
18
+
19
+ part /boot --fstype=ext4 --size=500
20
+ part pv.2 --grow --size=500
21
+
22
+ volgroup vg_vagrant --pesize=32768 pv.2
23
+ logvol / --fstype=ext4 --name=lv_root --vgname=vg_vagrant --size=1024 --grow
24
+ logvol swap --fstype=swap --name=lv_swap --vgname=vg_vagrant --size=528 --grow --maxsize=1056
25
+ bootloader --location=mbr --driveorder=sda --append="norhgb"
26
+ # Disable remote repositories, as this is a non-netinst install.
27
+ #repo --name="Fedora 15 - i386" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-15&arch=i386 --cost=1000
28
+ #repo --name="Fedora 15 - i386 - Updates" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f15&arch=i386 --cost=1000
29
+ services --enabled network
30
+ reboot
31
+
32
+ %packages
33
+ @core
34
+ @online-docs
35
+
36
+ # Requirements for vagrant
37
+ kernel-PAE-devel
38
+ kernel-headers
39
+ make
40
+ gcc
41
+ %end
42
+
43
+ %post
44
+ # Make ssh quicker in disconnected situations.
45
+ echo 'UseDNS no' >> /etc/ssh/sshd_config
46
+
47
+ # Add Vagrant user and group.
48
+ /usr/sbin/groupadd vagrant
49
+ /usr/sbin/useradd vagrant -g vagrant
50
+ echo "vagrant"|passwd --stdin vagrant
51
+
52
+ # Give Vagrant user permission to sudo.
53
+ echo 'Defaults:vagrant !requiretty' > /etc/sudoers.d/vagrant
54
+ echo '%vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/vagrant
55
+ chmod 440 /etc/sudoers.d/vagrant
56
+
57
+ # Install vagrant authorized ssh key.
58
+ mkdir /home/vagrant/.ssh
59
+ curl -L 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' > /home/vagrant/.ssh/authorized_keys
60
+ chown vagrant:vagrant -R /home/vagrant/.ssh
61
+ chmod 700 /home/vagrant/.ssh
62
+ chmod 600 /home/vagrant/.ssh/authorized_keys
63
+ chcon -R unconfined_u:object_r:user_home_t:s0 /home/vagrant/.ssh
64
+ %end
@@ -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,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,95 @@
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
+ # make sure ssh is allowed
41
+ echo "sshd: ALL" > /etc/hosts.allow
42
+
43
+ # and everything else isn't
44
+ echo "ALL: ALL" > /etc/hosts.deny
45
+
46
+ # make sure sshd starts
47
+ sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
48
+
49
+ # install mitchellh's ssh key
50
+ mkdir /home/vagrant/.ssh
51
+ chmod 700 /home/vagrant/.ssh
52
+ wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
53
+ chmod 600 /home/vagrant/.ssh/authorized_keys
54
+ chown -R vagrant /home/vagrant/.ssh
55
+
56
+ # choose a mirror
57
+ sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
58
+
59
+ # update pacman
60
+ pacman -Syy
61
+ pacman -S --noconfirm pacman
62
+
63
+ # upgrade pacman db
64
+ pacman-db-upgrade
65
+ pacman -Syy
66
+
67
+ # install some packages
68
+ pacman -S --noconfirm glibc git
69
+ gem install --no-ri --no-rdoc chef facter
70
+ cd /tmp
71
+ git clone https://github.com/puppetlabs/puppet.git
72
+ cd puppet
73
+ ruby install.rb --bindir=/usr/bin --sbindir=/sbin
74
+
75
+ # install virtualbox guest additions
76
+ cd /tmp
77
+ wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso
78
+ mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt
79
+ sh /mnt/VBoxLinuxAdditions.run
80
+ umount /mnt
81
+ rm VBoxGuestAdditions_"$VBOX_VERSION".iso
82
+
83
+ # clean out pacman cache
84
+ pacman -Scc<<EOF
85
+ y
86
+ y
87
+ EOF
88
+
89
+ # zero out the fs
90
+ dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
91
+
92
+ ENDCHROOT
93
+
94
+ # and reboot!
95
+ 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
+ }
@@ -8,22 +8,22 @@ Veewee::Session.declare({
8
8
  :iso_download_timeout => "1000",
9
9
  :boot_wait => "5", :boot_cmd_sequence => [
10
10
  '<Enter>',
11
- '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
12
- '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
13
- '<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>',
14
- 'root<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
15
  'dhcpcd eth0<Enter><Wait><Wait>',
16
16
  'echo "sshd: ALL" > /etc/hosts.allow<Enter>',
17
17
  'passwd<Enter>',
18
18
  'vagrant<Enter>',
19
19
  'vagrant<Enter>',
20
20
  '/etc/rc.d/sshd start<Enter><Wait>',
21
- 'echo "Now we continue with the post-install.sh"<Enter>',
21
+ 'sleep 3 && wget 10.0.2.2:7122/aif.cfg<Enter>',
22
22
  ],
23
- :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "",
23
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "aif.cfg",
24
24
  :ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
25
25
  :ssh_host_port => "7222", :ssh_guest_port => "22",
26
26
  :sudo_cmd => "sh '%f'",
27
- :shutdown_cmd => "shutdown -H",
27
+ :shutdown_cmd => "shutdown -h now",
28
28
  :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
29
29
  })
@@ -0,0 +1,95 @@
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
+ # make sure ssh is allowed
41
+ echo "sshd: ALL" > /etc/hosts.allow
42
+
43
+ # and everything else isn't
44
+ echo "ALL: ALL" > /etc/hosts.deny
45
+
46
+ # make sure sshd starts
47
+ sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
48
+
49
+ # install mitchellh's ssh key
50
+ mkdir /home/vagrant/.ssh
51
+ chmod 700 /home/vagrant/.ssh
52
+ wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
53
+ chmod 600 /home/vagrant/.ssh/authorized_keys
54
+ chown -R vagrant /home/vagrant/.ssh
55
+
56
+ # choose a mirror
57
+ sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
58
+
59
+ # update pacman
60
+ pacman -Syy
61
+ pacman -S --noconfirm pacman
62
+
63
+ # upgrade pacman db
64
+ pacman-db-upgrade
65
+ pacman -Syy
66
+
67
+ # install some packages
68
+ pacman -S --noconfirm glibc git
69
+ gem install --no-ri --no-rdoc chef facter
70
+ cd /tmp
71
+ git clone https://github.com/puppetlabs/puppet.git
72
+ cd puppet
73
+ ruby install.rb --bindir=/usr/bin --sbindir=/sbin
74
+
75
+ # install virtualbox guest additions
76
+ cd /tmp
77
+ wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso
78
+ mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt
79
+ sh /mnt/VBoxLinuxAdditions.run
80
+ umount /mnt
81
+ rm VBoxGuestAdditions_"$VBOX_VERSION".iso
82
+
83
+ # clean out pacman cache
84
+ pacman -Scc<<EOF
85
+ y
86
+ y
87
+ EOF
88
+
89
+ # zero out the fs
90
+ dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
91
+
92
+ ENDCHROOT
93
+
94
+ # and reboot!
95
+ reboot