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.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +68 -0
- data/README.md +5 -0
- data/Rakefile +91 -0
- data/bin/vbox +73 -0
- data/lib/java/README.txt +5 -0
- data/lib/java/dir2floppy.jar +0 -0
- data/lib/java/dir2floppy.java +134 -0
- data/lib/vagrant_init.rb +6 -0
- data/lib/vbox.rb +2 -0
- data/lib/vbox/command.rb +82 -0
- data/lib/vbox/config.rb +5 -0
- data/lib/vbox/export.rb +65 -0
- data/lib/vbox/scancode.rb +208 -0
- data/lib/vbox/session.rb +893 -0
- data/lib/vbox/shell.rb +54 -0
- data/lib/vbox/ssh.rb +193 -0
- data/lib/vbox/transaction.rb +122 -0
- data/lib/vbox/utils.rb +26 -0
- data/lib/vbox/version.rb +3 -0
- data/lib/vbox/web.rb +48 -0
- data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
- data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
- data/templates/CentOS-6.0-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-6.0-i386-netboot/ks.cfg +52 -0
- data/templates/CentOS-6.0-i386-netboot/postinstall.sh +30 -0
- data/templates/CentOS-6.0-i386/definition.rb +17 -0
- data/templates/CentOS-6.0-i386/ks.cfg +47 -0
- data/templates/CentOS-6.0-i386/postinstall.sh +48 -0
- data/templates/CentOS-6.0-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +52 -0
- data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +30 -0
- data/templates/CentOS-6.0-x86_64/definition.rb +17 -0
- data/templates/CentOS-6.0-x86_64/ks.cfg +47 -0
- data/templates/CentOS-6.0-x86_64/postinstall.sh +48 -0
- data/templates/Debian-6.0.3-amd64-netboot/definition.rb +42 -0
- data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
- data/templates/Debian-6.0.3-amd64-netboot/preseed.cfg +42 -0
- data/templates/Debian-6.0.3-i386-netboot/definition.rb +44 -0
- data/templates/Debian-6.0.3-i386-netboot/postinstall.sh +80 -0
- data/templates/Debian-6.0.3-i386-netboot/preseed.cfg +42 -0
- data/templates/Fedora-15-i386-netboot/definition.rb +17 -0
- data/templates/Fedora-15-i386-netboot/ks.cfg +82 -0
- data/templates/Fedora-15-i386-netboot/postinstall.sh +18 -0
- data/templates/Fedora-15-i386/definition.rb +17 -0
- data/templates/Fedora-15-i386/ks.cfg +64 -0
- data/templates/Fedora-15-i386/postinstall.sh +33 -0
- data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
- data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
- data/templates/Fedora-15-x86_64/definition.rb +17 -0
- data/templates/Fedora-15-x86_64/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
- data/templates/Sysrescuecd-2.0.0-experimental/autorun0 +3 -0
- data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +20 -0
- data/templates/archlinux-i386-netboot/aif.cfg +34 -0
- data/templates/archlinux-i386-netboot/definition.rb +29 -0
- data/templates/archlinux-i386-netboot/postinstall.sh +87 -0
- data/templates/archlinux-i386-netboot/postinstall2.sh +28 -0
- data/templates/archlinux-i386/aif.cfg +33 -0
- data/templates/archlinux-i386/definition.rb +29 -0
- data/templates/archlinux-i386/postinstall.sh +106 -0
- data/templates/archlinux-x86_64-netboot/aif.cfg +34 -0
- data/templates/archlinux-x86_64-netboot/definition.rb +29 -0
- data/templates/archlinux-x86_64-netboot/postinstall.sh +90 -0
- data/templates/archlinux-x86_64-netboot/postinstall2.sh +28 -0
- data/templates/archlinux-x86_64/aif.cfg +33 -0
- data/templates/archlinux-x86_64/definition.rb +29 -0
- data/templates/archlinux-x86_64/postinstall.sh +90 -0
- data/templates/archlinux-x86_64/postinstall2.sh +38 -0
- data/templates/freebsd-8.2-experimental/definition.rb +19 -0
- data/templates/freebsd-8.2-experimental/postinstall.sh +191 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +35 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/pcinstall.fbg.cfg +58 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +93 -0
- data/templates/freebsd-8.2-pcbsd-i386/definition.rb +31 -0
- data/templates/freebsd-8.2-pcbsd-i386/pcinstall.fbg.cfg +57 -0
- data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +93 -0
- data/templates/gentoo-latest-i386-experimental/definition.rb +29 -0
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +184 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
- data/templates/solaris-11-express-i386/auto_install/ai.dtd +58 -0
- data/templates/solaris-11-express-i386/auto_install/ai_manifest.xml +241 -0
- data/templates/solaris-11-express-i386/auto_install/configuration.dtd +44 -0
- data/templates/solaris-11-express-i386/auto_install/default.xml +124 -0
- data/templates/solaris-11-express-i386/auto_install/default.xml.orig +124 -0
- data/templates/solaris-11-express-i386/auto_install/sc_profiles/static_network.xml +105 -0
- data/templates/solaris-11-express-i386/auto_install/software.dtd +105 -0
- data/templates/solaris-11-express-i386/auto_install/target.dtd +196 -0
- data/templates/solaris-11-express-i386/default.xml +121 -0
- data/templates/solaris-11-express-i386/definition.rb +65 -0
- data/templates/solaris-11-express-i386/postinstall.sh +98 -0
- data/templates/ubuntu-10.04.3-server-amd64/definition.rb +54 -0
- data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-10.04.3-server-i386/definition.rb +24 -0
- data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +91 -0
- data/templates/ubuntu-10.04.3-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-i386/postinstall.sh +90 -0
- data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
- data/validation/features/steps/ssh_steps.rb +169 -0
- data/validation/support/env.rb +1 -0
- data/validation/vagrant-private.key +27 -0
- data/validation/vagrant.feature +52 -0
- data/validation/vagrant.pub +1 -0
- data/vbox.gemspec +32 -0
- metadata +338 -0
|
@@ -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_64',
|
|
5
|
+
:iso_file => "archlinux-2010.05-netinstall-x86_64.iso",
|
|
6
|
+
:iso_src => "http://archlinux.mirror.kangaroot.net/iso/2010.05/archlinux-2010.05-netinstall-x86_64.iso",
|
|
7
|
+
:iso_md5 => "577ca8026a9997f7cecb430276d78793",
|
|
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,90 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# var to determine package source
|
|
4
|
+
PKGSRC=net
|
|
5
|
+
|
|
6
|
+
date > /etc/vagrant_box_build_time
|
|
7
|
+
|
|
8
|
+
# launch automated install
|
|
9
|
+
su -c 'aif -p automatic -c aif.cfg'
|
|
10
|
+
|
|
11
|
+
# copy over the vbox version file
|
|
12
|
+
/bin/cp -f /root/.vbox_version /mnt/root/.vbox_version
|
|
13
|
+
|
|
14
|
+
# chroot into the new system
|
|
15
|
+
mount -o bind /dev /mnt/dev
|
|
16
|
+
mount -o bind /sys /mnt/sys
|
|
17
|
+
mount -t proc none /mnt/proc
|
|
18
|
+
chroot /mnt <<ENDCHROOT
|
|
19
|
+
|
|
20
|
+
# make sure network is up and a nameserver is available
|
|
21
|
+
dhcpcd eth0
|
|
22
|
+
|
|
23
|
+
# sudo setup
|
|
24
|
+
# note: do not use tabs here, it autocompletes and borks the sudoers file
|
|
25
|
+
cat <<EOF > /etc/sudoers
|
|
26
|
+
root ALL=(ALL) ALL
|
|
27
|
+
%wheel ALL=(ALL) NOPASSWD: ALL
|
|
28
|
+
EOF
|
|
29
|
+
|
|
30
|
+
# set up user accounts
|
|
31
|
+
passwd<<EOF
|
|
32
|
+
vagrant
|
|
33
|
+
vagrant
|
|
34
|
+
EOF
|
|
35
|
+
useradd -m -G wheel -r vagrant
|
|
36
|
+
passwd -d vagrant
|
|
37
|
+
passwd vagrant<<EOF
|
|
38
|
+
vagrant
|
|
39
|
+
vagrant
|
|
40
|
+
EOF
|
|
41
|
+
|
|
42
|
+
# create puppet group
|
|
43
|
+
groupadd puppet
|
|
44
|
+
|
|
45
|
+
# make sure ssh is allowed
|
|
46
|
+
echo "sshd: ALL" > /etc/hosts.allow
|
|
47
|
+
|
|
48
|
+
# and everything else isn't
|
|
49
|
+
echo "ALL: ALL" > /etc/hosts.deny
|
|
50
|
+
|
|
51
|
+
# make sure sshd starts
|
|
52
|
+
sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
|
|
53
|
+
|
|
54
|
+
# install mitchellh's ssh key
|
|
55
|
+
mkdir /home/vagrant/.ssh
|
|
56
|
+
chmod 700 /home/vagrant/.ssh
|
|
57
|
+
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
|
|
58
|
+
chmod 600 /home/vagrant/.ssh/authorized_keys
|
|
59
|
+
chown -R vagrant /home/vagrant/.ssh
|
|
60
|
+
|
|
61
|
+
# choose a mirror
|
|
62
|
+
sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
|
|
63
|
+
|
|
64
|
+
# update pacman
|
|
65
|
+
[[ $PKGSRC == 'cd' ]] && pacman -Syy
|
|
66
|
+
[[ $PKGSRC == 'cd' ]] && pacman -S --noconfirm pacman
|
|
67
|
+
|
|
68
|
+
# upgrade pacman db
|
|
69
|
+
pacman-db-upgrade
|
|
70
|
+
pacman -Syy
|
|
71
|
+
|
|
72
|
+
# install some packages
|
|
73
|
+
pacman -S --noconfirm glibc git
|
|
74
|
+
gem install --no-ri --no-rdoc chef facter
|
|
75
|
+
cd /tmp
|
|
76
|
+
git clone https://github.com/puppetlabs/puppet.git
|
|
77
|
+
cd puppet
|
|
78
|
+
ruby install.rb --bindir=/usr/bin --sbindir=/sbin
|
|
79
|
+
|
|
80
|
+
# set up networking
|
|
81
|
+
[[ $PKGSRC == 'net' ]] && sed -i 's/^\(interface=*\)/\1eth0/' /etc/rc.conf
|
|
82
|
+
|
|
83
|
+
# leave the chroot
|
|
84
|
+
ENDCHROOT
|
|
85
|
+
|
|
86
|
+
# take down network to prevent next postinstall.sh from starting too soon
|
|
87
|
+
/etc/rc.d/network stop
|
|
88
|
+
|
|
89
|
+
# and reboot!
|
|
90
|
+
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 yajl'
|
|
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_64',
|
|
5
|
+
:iso_file => "archlinux-2010.05-core-x86_64.iso",
|
|
6
|
+
:iso_src => "http://archlinux.mirror.kangaroot.net/iso/2010.05/archlinux-2010.05-core-x86_64.iso",
|
|
7
|
+
:iso_md5 => "9e9057702af5826a3b924233bf44fe66",
|
|
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,90 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# var to determine package source
|
|
4
|
+
PKGSRC=cd
|
|
5
|
+
|
|
6
|
+
date > /etc/vagrant_box_build_time
|
|
7
|
+
|
|
8
|
+
# launch automated install
|
|
9
|
+
su -c 'aif -p automatic -c aif.cfg'
|
|
10
|
+
|
|
11
|
+
# copy over the vbox version file
|
|
12
|
+
/bin/cp -f /root/.vbox_version /mnt/root/.vbox_version
|
|
13
|
+
|
|
14
|
+
# chroot into the new system
|
|
15
|
+
mount -o bind /dev /mnt/dev
|
|
16
|
+
mount -o bind /sys /mnt/sys
|
|
17
|
+
mount -t proc none /mnt/proc
|
|
18
|
+
chroot /mnt <<ENDCHROOT
|
|
19
|
+
|
|
20
|
+
# make sure network is up and a nameserver is available
|
|
21
|
+
dhcpcd eth0
|
|
22
|
+
|
|
23
|
+
# sudo setup
|
|
24
|
+
# note: do not use tabs here, it autocompletes and borks the sudoers file
|
|
25
|
+
cat <<EOF > /etc/sudoers
|
|
26
|
+
root ALL=(ALL) ALL
|
|
27
|
+
%wheel ALL=(ALL) NOPASSWD: ALL
|
|
28
|
+
EOF
|
|
29
|
+
|
|
30
|
+
# set up user accounts
|
|
31
|
+
passwd<<EOF
|
|
32
|
+
vagrant
|
|
33
|
+
vagrant
|
|
34
|
+
EOF
|
|
35
|
+
useradd -m -G wheel -r vagrant
|
|
36
|
+
passwd -d vagrant
|
|
37
|
+
passwd vagrant<<EOF
|
|
38
|
+
vagrant
|
|
39
|
+
vagrant
|
|
40
|
+
EOF
|
|
41
|
+
|
|
42
|
+
# create puppet group
|
|
43
|
+
groupadd puppet
|
|
44
|
+
|
|
45
|
+
# make sure ssh is allowed
|
|
46
|
+
echo "sshd: ALL" > /etc/hosts.allow
|
|
47
|
+
|
|
48
|
+
# and everything else isn't
|
|
49
|
+
echo "ALL: ALL" > /etc/hosts.deny
|
|
50
|
+
|
|
51
|
+
# make sure sshd starts
|
|
52
|
+
sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf
|
|
53
|
+
|
|
54
|
+
# install mitchellh's ssh key
|
|
55
|
+
mkdir /home/vagrant/.ssh
|
|
56
|
+
chmod 700 /home/vagrant/.ssh
|
|
57
|
+
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
|
|
58
|
+
chmod 600 /home/vagrant/.ssh/authorized_keys
|
|
59
|
+
chown -R vagrant /home/vagrant/.ssh
|
|
60
|
+
|
|
61
|
+
# choose a mirror
|
|
62
|
+
sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist
|
|
63
|
+
|
|
64
|
+
# update pacman
|
|
65
|
+
[[ $PKGSRC == 'cd' ]] && pacman -Syy
|
|
66
|
+
[[ $PKGSRC == 'cd' ]] && pacman -S --noconfirm pacman
|
|
67
|
+
|
|
68
|
+
# upgrade pacman db
|
|
69
|
+
pacman-db-upgrade
|
|
70
|
+
pacman -Syy
|
|
71
|
+
|
|
72
|
+
# install some packages
|
|
73
|
+
pacman -S --noconfirm glibc git pkg-config fakeroot
|
|
74
|
+
gem install --no-ri --no-rdoc chef facter
|
|
75
|
+
cd /tmp
|
|
76
|
+
git clone https://github.com/puppetlabs/puppet.git
|
|
77
|
+
cd puppet
|
|
78
|
+
ruby install.rb --bindir=/usr/bin --sbindir=/sbin
|
|
79
|
+
|
|
80
|
+
# set up networking
|
|
81
|
+
[[ $PKGSRC == 'net' ]] && sed -i 's/^\(interface=*\)/\1eth0/' /etc/rc.conf
|
|
82
|
+
|
|
83
|
+
# leave the chroot
|
|
84
|
+
ENDCHROOT
|
|
85
|
+
|
|
86
|
+
# take down network to prevent next postinstall.sh from starting too soon
|
|
87
|
+
/etc/rc.d/network stop
|
|
88
|
+
|
|
89
|
+
# and reboot!
|
|
90
|
+
reboot
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# package-query
|
|
2
|
+
wget http://aur.archlinux.org/packages/package-query/PKGBUILD
|
|
3
|
+
makepkg -sfci --noconfirm --asroot
|
|
4
|
+
rm * -r
|
|
5
|
+
|
|
6
|
+
# yaourt
|
|
7
|
+
wget http://aur.archlinux.org/packages/yaourt/PKGBUILD
|
|
8
|
+
makepkg -sfci --noconfirm --asroot
|
|
9
|
+
rm * -r
|
|
10
|
+
|
|
11
|
+
# install virtualbox guest additions
|
|
12
|
+
VBOX_VERSION=$(cat /root/.vbox_version)
|
|
13
|
+
cd /tmp
|
|
14
|
+
wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso
|
|
15
|
+
mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt
|
|
16
|
+
sh /mnt/VBoxLinuxAdditions.run
|
|
17
|
+
umount /mnt
|
|
18
|
+
rm VBoxGuestAdditions_"$VBOX_VERSION".iso
|
|
19
|
+
|
|
20
|
+
# host-only networking
|
|
21
|
+
cat >> /etc/rc.local <<EOF
|
|
22
|
+
# enable DHCP at boot on eth0
|
|
23
|
+
# See https://wiki.archlinux.org/index.php/Network#DHCP_fails_at_boot
|
|
24
|
+
dhcpcd -k eth0
|
|
25
|
+
dhcpcd -nd eth0
|
|
26
|
+
EOF
|
|
27
|
+
|
|
28
|
+
# clean out pacman cache
|
|
29
|
+
pacman -Scc<<EOF
|
|
30
|
+
y
|
|
31
|
+
y
|
|
32
|
+
EOF
|
|
33
|
+
|
|
34
|
+
# zero out the fs
|
|
35
|
+
dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
|
|
36
|
+
|
|
37
|
+
# and the final reboot!
|
|
38
|
+
reboot
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Veewee::Session.declare({
|
|
2
|
+
:cpu_count => '1', :memory_size=> '256',
|
|
3
|
+
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
|
|
4
|
+
:os_type_id => 'FreeBSD_64',
|
|
5
|
+
:iso_file => "mfsbsd-8.2-amd64.iso",
|
|
6
|
+
:iso_src => "http://mfsbsd.vx.sk/iso/mfsbsd-8.2-amd64.iso",
|
|
7
|
+
:iso_md5 => "3296cf0e5844",
|
|
8
|
+
:iso_download_timeout => "1000",
|
|
9
|
+
:boot_wait => "10", :boot_cmd_sequence => [
|
|
10
|
+
'<Enter>'
|
|
11
|
+
],
|
|
12
|
+
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "",
|
|
13
|
+
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "mfsroot", :ssh_key => "",
|
|
14
|
+
:ssh_host_port => "7222", :ssh_guest_port => "22",
|
|
15
|
+
:sudo_cmd => "sh '%f'",
|
|
16
|
+
:shutdown_cmd => "shutdown -H",
|
|
17
|
+
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
|
|
18
|
+
})
|
|
19
|
+
#'setkmap=us dodhcp=eth0 dhcphostname=%NAME% ar_source=http://%IP%:%PORT%/ autoruns=0 rootpass=vagrant',
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
date > /etc/vagrant_box_build_time
|
|
2
|
+
|
|
3
|
+
#http://www.freebsd.org/doc/en_US.ISO8859-1/articles/remote-install/installation.html
|
|
4
|
+
dd if=/dev/zero of=/dev/ad4 count=2
|
|
5
|
+
#bsdlabel -w -B /dev/ad4
|
|
6
|
+
|
|
7
|
+
sysctl kern.geom.debugflags=16
|
|
8
|
+
|
|
9
|
+
#http://forum.nginx.org/read.php?23,146311,146451
|
|
10
|
+
# Init the disk with an MBR
|
|
11
|
+
gpart create -s mbr ad4
|
|
12
|
+
# Create a BSD container
|
|
13
|
+
gpart add -t freebsd ad4
|
|
14
|
+
# Init with a BSD scheme
|
|
15
|
+
gpart create -s bsd ad4s1
|
|
16
|
+
|
|
17
|
+
# 1GB for /
|
|
18
|
+
gpart add -t freebsd-ufs -s 1G ad4s1
|
|
19
|
+
|
|
20
|
+
gpart add -t freebsd-swap -s 2G ad4s1
|
|
21
|
+
# 2GB for swap
|
|
22
|
+
gpart add -t freebsd-ufs -s 2G ad4s1
|
|
23
|
+
# 2GB for /var
|
|
24
|
+
gpart add -t freebsd-ufs ad4s1
|
|
25
|
+
# all rest for /usr
|
|
26
|
+
|
|
27
|
+
#install bootcode
|
|
28
|
+
gpart bootcode -p /boot/boot -i 1 ad4s1
|
|
29
|
+
gpart set -a active -i ad4
|
|
30
|
+
|
|
31
|
+
cat <<EOF >/install.cfg
|
|
32
|
+
# This is the installation configuration file for our rackmounted FreeBSD
|
|
33
|
+
# cluster machines
|
|
34
|
+
|
|
35
|
+
# Turn on extra debugging.
|
|
36
|
+
debug=yes
|
|
37
|
+
|
|
38
|
+
#releaseName 8.0-RELEASE
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
################################
|
|
42
|
+
# My host specific data
|
|
43
|
+
#hostname=dragonfly
|
|
44
|
+
#domainname=cs.duke.edu
|
|
45
|
+
#nameserver=152.3.145.240
|
|
46
|
+
#defaultrouter=152.3.145.240
|
|
47
|
+
#ipaddr=152.3.145.64
|
|
48
|
+
#netmask=255.255.255.0
|
|
49
|
+
################################
|
|
50
|
+
tryDHCP=NO
|
|
51
|
+
|
|
52
|
+
################################
|
|
53
|
+
# Which installation device to use
|
|
54
|
+
# ftp://ftp.smr.ru/pub/0/FreeBSD/current/src/release/sysinstall/sysinstall.h
|
|
55
|
+
_ftpPath=ftp://ftp2.freebsd.org/pub/FreeBSD/
|
|
56
|
+
#_httpPath=ftp://ftp2.freebsd.org/pub/FreeBSD/
|
|
57
|
+
#httpProxy=192.168.2.10:800
|
|
58
|
+
netDev=em0
|
|
59
|
+
mediaSetFTP
|
|
60
|
+
#mediaSetHTTP
|
|
61
|
+
|
|
62
|
+
################################
|
|
63
|
+
|
|
64
|
+
################################
|
|
65
|
+
# Select which distributions we want.
|
|
66
|
+
#dists= bin doc games manpages catpages proflibs dict info des compat1x compat20 compat21 X331bin X331cfg X331doc X331html X331lib X331lkit X331man X331prog X331ps X331set X331VG16 X331nest X331vfb X331fnts X331f100 X331fcyr X331fscl X331fnon sinclude
|
|
67
|
+
#distSetCustom
|
|
68
|
+
distSetMinimum
|
|
69
|
+
################################
|
|
70
|
+
|
|
71
|
+
################################
|
|
72
|
+
# Now set the parameters for the partition editor on ad4.
|
|
73
|
+
disk=ad4
|
|
74
|
+
partition=all
|
|
75
|
+
#http://www.mail-archive.com/freebsd-questions@freebsd.org/msg212036.html
|
|
76
|
+
bootManager=standard
|
|
77
|
+
diskPartitionEditor
|
|
78
|
+
#diskPartitionWrite
|
|
79
|
+
|
|
80
|
+
################################
|
|
81
|
+
|
|
82
|
+
################################
|
|
83
|
+
# All sizes are expressed in 512 byte blocks!
|
|
84
|
+
#
|
|
85
|
+
# A 960MB root partition, followed by a 0.5G swap partition, followed by
|
|
86
|
+
# a 1G /var, and a /usr using all the remaining space on the disk
|
|
87
|
+
#
|
|
88
|
+
ad4s1-1=ufs 1966080 /mnt
|
|
89
|
+
ad4s1-2=swap 1048576 none
|
|
90
|
+
ad4s1-3=ufs 2097152 /mnt/var
|
|
91
|
+
ad4s1-4=ufs 0 /mnt/usr
|
|
92
|
+
# Let's do it!
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
diskLabelEditor
|
|
96
|
+
diskLabelCommit
|
|
97
|
+
|
|
98
|
+
#http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2010-11/msg00420.html
|
|
99
|
+
installRoot=/mnt
|
|
100
|
+
#
|
|
101
|
+
|
|
102
|
+
# OK, everything is set. Do it!
|
|
103
|
+
installCommit
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# Install some packages at the end.
|
|
107
|
+
# package=LPRng-3.2.3
|
|
108
|
+
# packageAdd
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# Install some packages at the end.
|
|
112
|
+
|
|
113
|
+
#
|
|
114
|
+
# this last package is special. It is used to configure the machine.
|
|
115
|
+
# it installs several files (like /root/.rhosts) an its installation
|
|
116
|
+
# script tweaks several options in /etc/rc.conf
|
|
117
|
+
#
|
|
118
|
+
#package=ari-0.0
|
|
119
|
+
#packageAdd
|
|
120
|
+
|
|
121
|
+
EOF
|
|
122
|
+
|
|
123
|
+
sysinstall configFile=/install.cfg loadConfig
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
#http://www.daemonforums.org/showthread.php?t=4389
|
|
127
|
+
|
|
128
|
+
cd /mnt/boot
|
|
129
|
+
cp -Rp GENERIC/* kernel/
|
|
130
|
+
|
|
131
|
+
#For some reason this is the disk layout the sysinstall creates
|
|
132
|
+
|
|
133
|
+
cat <<EOF > /mnt/etc/fstab
|
|
134
|
+
/dev/ad4s1b none swap sw 0 0
|
|
135
|
+
/dev/ad4s1d / ufs rw 0 0
|
|
136
|
+
/dev/ad4s1f /usr ufs rw 0 0
|
|
137
|
+
/dev/ad4s1e /var ufs rw 0 0
|
|
138
|
+
EOF
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# boot0cfg -B ad4
|
|
142
|
+
#make the menu appear
|
|
143
|
+
|
|
144
|
+
# Booting mentions an error
|
|
145
|
+
# Invalid partition
|
|
146
|
+
# FAILS WITH: 0:ad(0,a)/boot/kernel/kernel
|
|
147
|
+
# WORKS WITH: 0:ad(4,d)/boot/loader
|
|
148
|
+
|
|
149
|
+
#http://www.mail-archive.com/freebsd-questions@freebsd.org/msg72530.html
|
|
150
|
+
cat <<EOF > /mnt/boot/loader.conf
|
|
151
|
+
#geom_label_load="YES"
|
|
152
|
+
#root_disk_unit="4"
|
|
153
|
+
#currdev="disk4s1d"
|
|
154
|
+
#rootdev="disk4s1d"
|
|
155
|
+
#vfs.root.mountfrom="ufs:/dev/ad4s1d"
|
|
156
|
+
EOF
|
|
157
|
+
|
|
158
|
+
#activate dhcp
|
|
159
|
+
cat <<EOF > /mnt/etc/rc.conf
|
|
160
|
+
ifconfig_DEFAULT="DHCP"
|
|
161
|
+
EOF
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
#The vi edit program needs a /var/tmp/vi.recover file.
|
|
165
|
+
|
|
166
|
+
mkdir -p /mnt/usr/local/etc/rc.d/
|
|
167
|
+
cd /mnt/usr/local/etc/rc.d/
|
|
168
|
+
cat <<EOF > mkvirecover
|
|
169
|
+
#!/bin/sh
|
|
170
|
+
# PROVIDE: mkvirecover
|
|
171
|
+
# REQUIRE: mountcritremote
|
|
172
|
+
# BEFORE: DAEMON virecover
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
. /etc/rc.subr
|
|
176
|
+
|
|
177
|
+
name="mkvirecover"
|
|
178
|
+
stop_cmd=":"
|
|
179
|
+
start_cmd="mkvirecover_start"
|
|
180
|
+
|
|
181
|
+
mkvirecover_start()
|
|
182
|
+
{
|
|
183
|
+
[ -d /var/tmp/vi.recover ] || mkdir -m 1777 /var/tmp/vi.recover
|
|
184
|
+
echo '.'
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
load_rc_config "\$name"
|
|
188
|
+
run_rc_command "\$1"
|
|
189
|
+
EOF
|
|
190
|
+
|
|
191
|
+
chmod 555 /mnt/usr/local/etc/rc.d/mkvirecover
|