image_optim_pack 0.2.3 → 0.3.0

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 (132) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +3 -0
  4. data/.travis.yml +12 -9
  5. data/Makefile +39 -12
  6. data/README.markdown +14 -9
  7. data/Vagrantfile +45 -7
  8. data/boxes/.gitignore +3 -0
  9. data/boxes/.rubocop.yml +10 -0
  10. data/boxes/Gemfile +6 -0
  11. data/boxes/Rakefile +143 -0
  12. data/boxes/definitions/centos-amd64/definition.rb +30 -0
  13. data/boxes/definitions/centos-amd64/ks.cfg +37 -0
  14. data/boxes/definitions/centos-i386/definition.rb +30 -0
  15. data/boxes/definitions/centos-i386/ks.cfg +37 -0
  16. data/boxes/definitions/centos-postinstall.sh +33 -0
  17. data/boxes/definitions/freebsd-amd64/definition.rb +38 -0
  18. data/boxes/definitions/freebsd-amd64/install.sh +66 -0
  19. data/boxes/definitions/freebsd-i386/definition.rb +38 -0
  20. data/boxes/definitions/freebsd-i386/install.sh +66 -0
  21. data/boxes/definitions/freebsd-postinstall.sh +38 -0
  22. data/boxes/definitions/openbsd-amd64/definition.rb +71 -0
  23. data/boxes/definitions/openbsd-i386/definition.rb +71 -0
  24. data/boxes/definitions/openbsd-postinstall.sh +29 -0
  25. data/image_optim_pack.gemspec +2 -4
  26. data/lib/image_optim/pack.rb +2 -3
  27. data/script/livecheck +29 -2
  28. data/script/run +32 -6
  29. data/script/update_versions +2 -0
  30. data/spec/image_optim/pack_spec.rb +2 -2
  31. data/vendor/{darwin/i386 → darwin-i386}/advpng +0 -0
  32. data/vendor/{darwin/i386 → darwin-i386}/gifsicle +0 -0
  33. data/vendor/{darwin/i386 → darwin-i386}/jhead +0 -0
  34. data/vendor/{darwin/i386 → darwin-i386}/jpeg-recompress +0 -0
  35. data/vendor/{darwin/i386 → darwin-i386}/jpegoptim +0 -0
  36. data/vendor/{darwin/i386 → darwin-i386}/jpegtran +0 -0
  37. data/vendor/{darwin/i386 → darwin-i386}/libjpeg.dylib +0 -0
  38. data/vendor/{darwin/i386 → darwin-i386}/libpng.dylib +0 -0
  39. data/vendor/{darwin/i386 → darwin-i386}/libz.dylib +0 -0
  40. data/vendor/{darwin/i386 → darwin-i386}/optipng +0 -0
  41. data/vendor/darwin-i386/pngcrush +0 -0
  42. data/vendor/{darwin/i386 → darwin-i386}/pngquant +0 -0
  43. data/vendor/{darwin/x86_64 → darwin-x86_64}/advpng +0 -0
  44. data/vendor/{darwin/x86_64 → darwin-x86_64}/gifsicle +0 -0
  45. data/vendor/{darwin/x86_64 → darwin-x86_64}/jhead +0 -0
  46. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpeg-recompress +0 -0
  47. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegoptim +0 -0
  48. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegtran +0 -0
  49. data/vendor/{darwin/x86_64 → darwin-x86_64}/libjpeg.dylib +0 -0
  50. data/vendor/{darwin/x86_64 → darwin-x86_64}/libpng.dylib +0 -0
  51. data/vendor/{darwin/x86_64 → darwin-x86_64}/libz.dylib +0 -0
  52. data/vendor/{darwin/x86_64 → darwin-x86_64}/optipng +0 -0
  53. data/vendor/darwin-x86_64/pngcrush +0 -0
  54. data/vendor/{darwin/x86_64 → darwin-x86_64}/pngquant +0 -0
  55. data/vendor/freebsd-amd64/advpng +0 -0
  56. data/vendor/freebsd-amd64/gifsicle +0 -0
  57. data/vendor/freebsd-amd64/jhead +0 -0
  58. data/vendor/freebsd-amd64/jpeg-recompress +0 -0
  59. data/vendor/freebsd-amd64/jpegoptim +0 -0
  60. data/vendor/freebsd-amd64/jpegtran +0 -0
  61. data/vendor/freebsd-amd64/libjpeg.so +0 -0
  62. data/vendor/freebsd-amd64/libpng.so +0 -0
  63. data/vendor/freebsd-amd64/libz.so +0 -0
  64. data/vendor/freebsd-amd64/optipng +0 -0
  65. data/vendor/freebsd-amd64/pngcrush +0 -0
  66. data/vendor/freebsd-amd64/pngquant +0 -0
  67. data/vendor/freebsd-i386/advpng +0 -0
  68. data/vendor/freebsd-i386/gifsicle +0 -0
  69. data/vendor/freebsd-i386/jhead +0 -0
  70. data/vendor/freebsd-i386/jpeg-recompress +0 -0
  71. data/vendor/freebsd-i386/jpegoptim +0 -0
  72. data/vendor/freebsd-i386/jpegtran +0 -0
  73. data/vendor/freebsd-i386/libjpeg.so +0 -0
  74. data/vendor/freebsd-i386/libpng.so +0 -0
  75. data/vendor/freebsd-i386/libz.so +0 -0
  76. data/vendor/freebsd-i386/optipng +0 -0
  77. data/vendor/freebsd-i386/pngcrush +0 -0
  78. data/vendor/freebsd-i386/pngquant +0 -0
  79. data/vendor/{linux/i686 → linux-i686}/advpng +0 -0
  80. data/vendor/{linux/i686 → linux-i686}/gifsicle +0 -0
  81. data/vendor/{linux/i686 → linux-i686}/jhead +0 -0
  82. data/vendor/{linux/i686 → linux-i686}/jpeg-recompress +0 -0
  83. data/vendor/{linux/i686 → linux-i686}/jpegoptim +0 -0
  84. data/vendor/{linux/i686 → linux-i686}/jpegtran +0 -0
  85. data/vendor/{linux/i686 → linux-i686}/libjpeg.so +0 -0
  86. data/vendor/{linux/i686 → linux-i686}/libpng.so +0 -0
  87. data/vendor/{linux/i686 → linux-i686}/libz.so +0 -0
  88. data/vendor/{linux/i686 → linux-i686}/optipng +0 -0
  89. data/vendor/linux-i686/pngcrush +0 -0
  90. data/vendor/{linux/i686 → linux-i686}/pngquant +0 -0
  91. data/vendor/{linux/x86_64 → linux-x86_64}/advpng +0 -0
  92. data/vendor/{linux/x86_64 → linux-x86_64}/gifsicle +0 -0
  93. data/vendor/{linux/x86_64 → linux-x86_64}/jhead +0 -0
  94. data/vendor/{linux/x86_64 → linux-x86_64}/jpeg-recompress +0 -0
  95. data/vendor/{linux/x86_64 → linux-x86_64}/jpegoptim +0 -0
  96. data/vendor/{linux/x86_64 → linux-x86_64}/jpegtran +0 -0
  97. data/vendor/{linux/x86_64 → linux-x86_64}/libjpeg.so +0 -0
  98. data/vendor/{linux/x86_64 → linux-x86_64}/libpng.so +0 -0
  99. data/vendor/{linux/x86_64 → linux-x86_64}/libz.so +0 -0
  100. data/vendor/{linux/x86_64 → linux-x86_64}/optipng +0 -0
  101. data/vendor/linux-x86_64/pngcrush +0 -0
  102. data/vendor/{linux/x86_64 → linux-x86_64}/pngquant +0 -0
  103. data/vendor/openbsd-amd64/advpng +0 -0
  104. data/vendor/openbsd-amd64/gifsicle +0 -0
  105. data/vendor/openbsd-amd64/jhead +0 -0
  106. data/vendor/openbsd-amd64/jpeg-recompress +0 -0
  107. data/vendor/openbsd-amd64/jpegoptim +0 -0
  108. data/vendor/openbsd-amd64/jpegtran +0 -0
  109. data/vendor/openbsd-amd64/libjpeg.so +0 -0
  110. data/vendor/openbsd-amd64/libpng.so +0 -0
  111. data/vendor/openbsd-amd64/libz.so +0 -0
  112. data/vendor/openbsd-amd64/optipng +0 -0
  113. data/vendor/openbsd-amd64/pngcrush +0 -0
  114. data/vendor/openbsd-amd64/pngquant +0 -0
  115. data/vendor/openbsd-i386/advpng +0 -0
  116. data/vendor/openbsd-i386/gifsicle +0 -0
  117. data/vendor/openbsd-i386/jhead +0 -0
  118. data/vendor/openbsd-i386/jpeg-recompress +0 -0
  119. data/vendor/openbsd-i386/jpegoptim +0 -0
  120. data/vendor/openbsd-i386/jpegtran +0 -0
  121. data/vendor/openbsd-i386/libjpeg.so +0 -0
  122. data/vendor/openbsd-i386/libpng.so +0 -0
  123. data/vendor/openbsd-i386/libz.so +0 -0
  124. data/vendor/openbsd-i386/optipng +0 -0
  125. data/vendor/openbsd-i386/pngcrush +0 -0
  126. data/vendor/openbsd-i386/pngquant +0 -0
  127. metadata +115 -93
  128. data/script/vm_init +0 -30
  129. data/vendor/darwin/i386/pngcrush +0 -0
  130. data/vendor/darwin/x86_64/pngcrush +0 -0
  131. data/vendor/linux/i686/pngcrush +0 -0
  132. data/vendor/linux/x86_64/pngcrush +0 -0
@@ -0,0 +1,30 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'RedHat6_64',
8
+ :iso_file => 'CentOS-6.5-x86_64-minimal.iso',
9
+ :iso_src => 'http://yum.singlehop.com/CentOS/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso',
10
+ :iso_sha256 => 'f9d84907d77df62017944cb23cab66305e94ee6ae6c1126415b81cc5e999bdd0',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>',
15
+ ],
16
+ :kickstart_port => '7122',
17
+ :kickstart_timeout => '300',
18
+ :kickstart_file => 'ks.cfg',
19
+ :ssh_login_timeout => '10000',
20
+ :ssh_user => 'veewee',
21
+ :ssh_password => 'veewee',
22
+ :ssh_key => '',
23
+ :ssh_host_port => '7222',
24
+ :ssh_guest_port => '22',
25
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
26
+ :shutdown_cmd => '/sbin/halt -h -p',
27
+ :postinstall_files => %w[../centos-postinstall.sh],
28
+ :postinstall_timeout => '10000',
29
+ :skip_iso_transfer => true,
30
+ })
@@ -0,0 +1,37 @@
1
+ install
2
+ cdrom
3
+ lang en_US.UTF-8
4
+ keyboard us
5
+ network --bootproto=dhcp
6
+ rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
7
+ firewall --enabled --service=ssh
8
+ authconfig --enableshadow --passalgo=sha512
9
+ selinux --disabled
10
+ timezone UTC
11
+ bootloader --location=mbr
12
+
13
+ text
14
+ skipx
15
+ zerombr
16
+
17
+ clearpart --all --initlabel
18
+ autopart
19
+
20
+ auth --useshadow --enablemd5
21
+ firstboot --disabled
22
+ reboot
23
+
24
+ %packages --nobase
25
+ @core
26
+ openssh-clients
27
+ %end
28
+
29
+ %post
30
+ /usr/bin/yum -y install sudo
31
+ /usr/sbin/groupadd veewee
32
+ /usr/sbin/useradd veewee -g veewee -G wheel
33
+ echo "veewee"|passwd --stdin veewee
34
+ echo "veewee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/veewee
35
+ chmod 0440 /etc/sudoers.d/veewee
36
+ %end
37
+
@@ -0,0 +1,30 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'RedHat',
8
+ :iso_file => 'CentOS-6.5-i386-minimal.iso',
9
+ :iso_src => 'http://yum.singlehop.com/CentOS/6.5/isos/i386/CentOS-6.5-i386-minimal.iso',
10
+ :iso_sha256 => '3e8fb326bf389c631dcea9c16da6ebcd2c6f150d526e147c1307beb9314eb794',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>',
15
+ ],
16
+ :kickstart_port => '7122',
17
+ :kickstart_timeout => '300',
18
+ :kickstart_file => 'ks.cfg',
19
+ :ssh_login_timeout => '10000',
20
+ :ssh_user => 'veewee',
21
+ :ssh_password => 'veewee',
22
+ :ssh_key => '',
23
+ :ssh_host_port => '7222',
24
+ :ssh_guest_port => '22',
25
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
26
+ :shutdown_cmd => '/sbin/halt -h -p',
27
+ :postinstall_files => %w[../centos-postinstall.sh],
28
+ :postinstall_timeout => '10000',
29
+ :skip_iso_transfer => true,
30
+ })
@@ -0,0 +1,37 @@
1
+ install
2
+ cdrom
3
+ lang en_US.UTF-8
4
+ keyboard us
5
+ network --bootproto=dhcp
6
+ rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
7
+ firewall --enabled --service=ssh
8
+ authconfig --enableshadow --passalgo=sha512
9
+ selinux --disabled
10
+ timezone UTC
11
+ bootloader --location=mbr
12
+
13
+ text
14
+ skipx
15
+ zerombr
16
+
17
+ clearpart --all --initlabel
18
+ autopart
19
+
20
+ auth --useshadow --enablemd5
21
+ firstboot --disabled
22
+ reboot
23
+
24
+ %packages --nobase
25
+ @core
26
+ openssh-clients
27
+ %end
28
+
29
+ %post
30
+ /usr/bin/yum -y install sudo
31
+ /usr/sbin/groupadd veewee
32
+ /usr/sbin/useradd veewee -g veewee -G wheel
33
+ echo "veewee"|passwd --stdin veewee
34
+ echo "veewee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/veewee
35
+ chmod 0440 /etc/sudoers.d/veewee
36
+ %end
37
+
@@ -0,0 +1,33 @@
1
+ set -ex
2
+
3
+ sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
4
+
5
+ yum -y install wget
6
+
7
+ # Make ssh faster by not waiting on DNS
8
+ echo "UseDNS no" >> /etc/ssh/sshd_config
9
+
10
+ # Vagrant specific
11
+ date > /etc/vagrant_box_build_time
12
+
13
+ # Add vagrant user
14
+ /usr/sbin/groupadd vagrant
15
+ /usr/sbin/useradd vagrant -g vagrant -G wheel
16
+ echo "vagrant"|passwd --stdin vagrant
17
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
18
+ chmod 0440 /etc/sudoers.d/vagrant
19
+
20
+ # Installing vagrant keys
21
+ mkdir -pm 700 /home/vagrant/.ssh
22
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
23
+ chmod 0600 /home/vagrant/.ssh/authorized_keys
24
+ chown -R vagrant /home/vagrant/.ssh
25
+
26
+ yum -y clean all
27
+
28
+ # Remove traces of mac address from network configuration
29
+ sed -i /HWADDR/d /etc/sysconfig/network-scripts/ifcfg-eth0
30
+ rm /etc/udev/rules.d/70-persistent-net.rules
31
+
32
+ # Zero out the free space to save space in the final image
33
+ dd if=/dev/zero of=/filler bs=1M || rm /filler
@@ -0,0 +1,38 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'FreeBSD_64',
8
+ :iso_file => 'FreeBSD-9.3-RELEASE-amd64-disc1.iso',
9
+ :iso_src => 'http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.3/FreeBSD-9.3-RELEASE-amd64-disc1.iso',
10
+ :iso_sha256 => '5a3c82653d77bba7d7ded8bd7efbedc09d52cf4045d98ce52a82c9e0f8fa9b0e',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Esc>',
15
+ 'boot -s',
16
+ '<Enter>',
17
+ '<Wait>' * 10,
18
+ '/bin/sh<Enter>',
19
+ 'mdmfs -s 100m md1 /tmp<Enter>',
20
+ 'dhclient -l /tmp/dhclient.lease.em0 em0<Enter>',
21
+ '<Wait>' * 10,
22
+ 'fetch -o /tmp/install.sh http://%IP%:%PORT%/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh %NAME%<Enter>',
23
+ ],
24
+ :kickstart_port => '7122',
25
+ :kickstart_timeout => '300',
26
+ :kickstart_file => 'install.sh',
27
+ :ssh_login_timeout => '10000',
28
+ :ssh_user => 'root',
29
+ :ssh_password => 'vagrant',
30
+ :ssh_key => '',
31
+ :ssh_host_port => '7222',
32
+ :ssh_guest_port => '22',
33
+ :sudo_cmd => "sh '%f'",
34
+ :shutdown_cmd => 'shutdown -p now',
35
+ :postinstall_files => %w[../freebsd-postinstall.sh],
36
+ :postinstall_timeout => '10000',
37
+ :skip_iso_transfer => true,
38
+ })
@@ -0,0 +1,66 @@
1
+ #!/bin/sh -x
2
+
3
+ # Credit: http://www.aisecure.net/2011/05/01/root-on-zfs-freebsd-current/
4
+
5
+ NAME=$1
6
+
7
+ # create disks
8
+ gpart create -s gpt ada0
9
+ gpart add -t freebsd-boot -l boot -b 40 -s 512K ada0
10
+ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
11
+ gpart add -t freebsd-ufs -l root -b 1M -s 2G ada0
12
+ gpart add -t freebsd-swap -l swap -s 512M ada0
13
+ gpart add -t freebsd-ufs -l var -s 1G ada0
14
+ gpart add -t freebsd-ufs -l tmp -s 512M ada0
15
+ gpart add -t freebsd-ufs -l usr -a 1M ada0
16
+
17
+ # create filesystems
18
+ newfs -U /dev/gpt/root
19
+ newfs -U /dev/gpt/var
20
+ newfs -U /dev/gpt/tmp
21
+ newfs -U /dev/gpt/usr
22
+
23
+ # mount the filesystems
24
+ mount /dev/gpt/root /mnt
25
+ mkdir /mnt/var && mount /dev/gpt/var /mnt/var
26
+ mkdir /mnt/tmp && mount /dev/gpt/tmp /mnt/tmp
27
+ mkdir /mnt/usr && mount /dev/gpt/usr /mnt/usr
28
+
29
+ # correct permissions
30
+ chmod 1777 /mnt/tmp
31
+ mkdir /mnt/var/tmp && chmod 1777 /mnt/var/tmp
32
+ cd /mnt && mkdir usr/home && ln -s usr/home home
33
+
34
+ # Install the OS
35
+ cd /usr/freebsd-dist
36
+ cat base.txz | tar --unlink -xpJf - -C /mnt
37
+ cat lib32.txz | tar --unlink -xpJf - -C /mnt
38
+ cat kernel.txz | tar --unlink -xpJf - -C /mnt
39
+ cat src.txz | tar --unlink -xpJf - -C /mnt
40
+
41
+ # Enable required services
42
+ cat >> /mnt/etc/rc.conf << EOT
43
+ hostname="${NAME}"
44
+ ifconfig_em0="dhcp"
45
+ sshd_enable="YES"
46
+ EOT
47
+
48
+ # Enable swap
49
+ cat >> /mnt/etc/fstab << EOT
50
+ /dev/gpt/swap none swap sw 0 0
51
+ /dev/gpt/root / ufs rw 1 1
52
+ /dev/gpt/var /var ufs rw 1 1
53
+ /dev/gpt/tmp /tmp ufs rw 1 1
54
+ /dev/gpt/usr /usr ufs rw 1 1
55
+ EOT
56
+
57
+ # Install a few requirements
58
+ touch /mnt/etc/resolv.conf
59
+ echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config
60
+
61
+ # Set up user accounts
62
+ mkdir /mnt/usr/home/vagrant && chown 1001:1001 /mnt/home/vagrant
63
+ echo "vagrant" | pw -V /mnt/etc useradd vagrant -h 0 -s csh -G wheel -d /home/vagrant -c "Vagrant User"
64
+ echo "vagrant" | pw -V /mnt/etc usermod root -h 0
65
+
66
+ reboot
@@ -0,0 +1,38 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'FreeBSD',
8
+ :iso_file => 'FreeBSD-9.3-RELEASE-i386-disc1.iso',
9
+ :iso_src => 'http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.3/FreeBSD-9.3-RELEASE-i386-disc1.iso',
10
+ :iso_sha256 => 'cab6aad9c3d5ea6a3fb4059f808225c67f1edaea730c555a86a9707ac41ba75d',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Esc>',
15
+ 'boot -s',
16
+ '<Enter>',
17
+ '<Wait>' * 10,
18
+ '/bin/sh<Enter>',
19
+ 'mdmfs -s 100m md1 /tmp<Enter>',
20
+ 'dhclient -l /tmp/dhclient.lease.em0 em0<Enter>',
21
+ '<Wait>' * 10,
22
+ 'fetch -o /tmp/install.sh http://%IP%:%PORT%/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh %NAME%<Enter>',
23
+ ],
24
+ :kickstart_port => '7122',
25
+ :kickstart_timeout => '300',
26
+ :kickstart_file => 'install.sh',
27
+ :ssh_login_timeout => '10000',
28
+ :ssh_user => 'root',
29
+ :ssh_password => 'vagrant',
30
+ :ssh_key => '',
31
+ :ssh_host_port => '7222',
32
+ :ssh_guest_port => '22',
33
+ :sudo_cmd => "sh '%f'",
34
+ :shutdown_cmd => 'shutdown -p now',
35
+ :postinstall_files => %w[../freebsd-postinstall.sh],
36
+ :postinstall_timeout => '10000',
37
+ :skip_iso_transfer => true,
38
+ })
@@ -0,0 +1,66 @@
1
+ #!/bin/sh -x
2
+
3
+ # Credit: http://www.aisecure.net/2011/05/01/root-on-zfs-freebsd-current/
4
+
5
+ NAME=$1
6
+
7
+ # create disks
8
+ gpart create -s gpt ada0
9
+ gpart add -t freebsd-boot -l boot -b 40 -s 512K ada0
10
+ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
11
+ gpart add -t freebsd-ufs -l root -b 1M -s 2G ada0
12
+ gpart add -t freebsd-swap -l swap -s 512M ada0
13
+ gpart add -t freebsd-ufs -l var -s 1G ada0
14
+ gpart add -t freebsd-ufs -l tmp -s 512M ada0
15
+ gpart add -t freebsd-ufs -l usr -a 1M ada0
16
+
17
+ # create filesystems
18
+ newfs -U /dev/gpt/root
19
+ newfs -U /dev/gpt/var
20
+ newfs -U /dev/gpt/tmp
21
+ newfs -U /dev/gpt/usr
22
+
23
+ # mount the filesystems
24
+ mount /dev/gpt/root /mnt
25
+ mkdir /mnt/var && mount /dev/gpt/var /mnt/var
26
+ mkdir /mnt/tmp && mount /dev/gpt/tmp /mnt/tmp
27
+ mkdir /mnt/usr && mount /dev/gpt/usr /mnt/usr
28
+
29
+ # correct permissions
30
+ chmod 1777 /mnt/tmp
31
+ mkdir /mnt/var/tmp && chmod 1777 /mnt/var/tmp
32
+ cd /mnt && mkdir usr/home && ln -s usr/home home
33
+
34
+ # Install the OS
35
+ cd /usr/freebsd-dist
36
+ cat base.txz | tar --unlink -xpJf - -C /mnt
37
+ cat lib32.txz | tar --unlink -xpJf - -C /mnt
38
+ cat kernel.txz | tar --unlink -xpJf - -C /mnt
39
+ cat src.txz | tar --unlink -xpJf - -C /mnt
40
+
41
+ # Enable required services
42
+ cat >> /mnt/etc/rc.conf << EOT
43
+ hostname="${NAME}"
44
+ ifconfig_em0="dhcp"
45
+ sshd_enable="YES"
46
+ EOT
47
+
48
+ # Enable swap
49
+ cat >> /mnt/etc/fstab << EOT
50
+ /dev/gpt/swap none swap sw 0 0
51
+ /dev/gpt/root / ufs rw 1 1
52
+ /dev/gpt/var /var ufs rw 1 1
53
+ /dev/gpt/tmp /tmp ufs rw 1 1
54
+ /dev/gpt/usr /usr ufs rw 1 1
55
+ EOT
56
+
57
+ # Install a few requirements
58
+ touch /mnt/etc/resolv.conf
59
+ echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config
60
+
61
+ # Set up user accounts
62
+ mkdir /mnt/usr/home/vagrant && chown 1001:1001 /mnt/home/vagrant
63
+ echo "vagrant" | pw -V /mnt/etc useradd vagrant -h 0 -s csh -G wheel -d /home/vagrant -c "Vagrant User"
64
+ echo "vagrant" | pw -V /mnt/etc usermod root -h 0
65
+
66
+ reboot
@@ -0,0 +1,38 @@
1
+ set -ex
2
+
3
+ ntpdate -v -b in.pool.ntp.org
4
+ date > /etc/vagrant_box_build_time
5
+
6
+ ASSUME_ALWAYS_YES=yes pkg info
7
+ pkg install -y sudo bash-static wget
8
+
9
+ # setup the vagrant key
10
+ mkdir -p /home/vagrant/.ssh
11
+ chmod 700 /home/vagrant/.ssh
12
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
13
+ chmod 600 /home/vagrant/.ssh/authorized_keys
14
+ chown -R vagrant /home/vagrant/.ssh
15
+
16
+ # passwordless sudo
17
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /usr/local/etc/sudoers
18
+
19
+ # undo customizations
20
+ sed -i '' -e '/^REFUSE /d' /etc/portsnap.conf
21
+ sed -i '' -e '/^PermitRootLogin /d' /etc/ssh/sshd_config
22
+
23
+ # set vagrant shell to bash
24
+ pw usermod vagrant -s /usr/local/bin/bash
25
+
26
+ # cleanup
27
+ sudo pkg clean -y
28
+ rm -rf \
29
+ /var/db/freebsd-update/* \
30
+ /var/cache/pkg/* \
31
+ /etc/ssh/ssh_host_key* \
32
+ /usr/src \
33
+ /var/log/* \
34
+ /var/tmp/* \
35
+ /tmp/*
36
+ dd if=/dev/zero of=filler bs=1M || rm filler
37
+
38
+ shutdown -p now
@@ -0,0 +1,71 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'OpenBSD_64',
8
+ :iso_file => 'OpenBSD-5.5-amd64.iso',
9
+ :iso_src => 'http://ftp3.usa.openbsd.org/pub/OpenBSD/5.5/amd64/install55.iso',
10
+ :iso_sha256 => 'cc465ce3f8397883e91c6e1a8a98b1b3507a338984bbfe8978050c5f8fdcaf3f',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '50',
13
+ :boot_cmd_sequence => [
14
+ 'I<Enter>', # I - install
15
+ 'us<Enter>', # set the keyboard
16
+ 'OpenBSD55-x64<Enter>', # set the hostname
17
+ '<Enter>', # Which nic to config ? [em0]
18
+ '<Enter>', # do you want dhcp ? [dhcp]
19
+ '<Wait>' * 5,
20
+ 'none<Enter>', # IPV6 for em0 ? [none]
21
+ 'done<Enter>', # Which other nic do you wish to configure [done]
22
+ 'vagrant<Enter>', # Pw for root account
23
+ 'vagrant<Enter>',
24
+ 'yes<Enter>', # Start sshd by default ? [yes]
25
+ 'no<Enter>', # Start ntpd by default ? [yes]
26
+ 'no<Enter>', # Do you want the X window system [yes]
27
+ 'vagrant<Enter>', # Setup a user ?
28
+ 'vagrant<Enter>', # Full username
29
+ 'vagrant<Enter>', # Pw for this user
30
+ 'vagrant<Enter>',
31
+ 'no<Enter>', # Do you want to disable sshd for root ? [yes]
32
+ 'GB<Enter>', # What timezone are you in ?
33
+ '<Enter>', # Available disks [sd0]
34
+ '<Enter>', # Use DUIDs rather than device names in fstab ? [yes]
35
+ 'W<Enter>', # Use (W)whole disk or (E)edit MBR ? [whole]
36
+ 'A<Enter>', # Use (A)auto layout ... ? [a]
37
+ '<Wait>' * 70,
38
+ 'cd<Enter>', # location of the sets [cd]
39
+ '<Enter>', # Available cd-roms : cd0
40
+ '<Enter>', # Pathname to sets ? [5.5/amd64]
41
+ '-game55.tgz<Enter>', # Remove games and X
42
+ '-xbase55.tgz<Enter>',
43
+ '-xetc55.tgz<Enter>',
44
+ '-xshare55.tgz<Enter>',
45
+ '-xfont55.tgz<Enter>',
46
+ '-xserv55.tgz<Enter>',
47
+ 'done<Enter>',
48
+ '<Wait>',
49
+ 'yes<Enter>', # CD does not contain SHA256.sig (5.5) Continue without verification?
50
+ 'done<Enter>', # Done installing ?
51
+ '<Wait>' * 6,
52
+ 'yes<Enter><Wait>', # Time appears wrong. Set to ...? [yes]
53
+ '<Wait>' * 6,
54
+ 'reboot<Enter>',
55
+ '<Wait>' * 6,
56
+ ],
57
+ :kickstart_port => '7122',
58
+ :kickstart_timeout => '300',
59
+ :kickstart_file => '',
60
+ :ssh_login_timeout => '10000',
61
+ :ssh_user => 'root',
62
+ :ssh_password => 'vagrant',
63
+ :ssh_key => '',
64
+ :ssh_host_port => '7222',
65
+ :ssh_guest_port => '22',
66
+ :sudo_cmd => "sh '%f'",
67
+ :shutdown_cmd => '/sbin/halt -p',
68
+ :postinstall_files => %w[../openbsd-postinstall.sh],
69
+ :postinstall_timeout => '10000',
70
+ :skip_iso_transfer => true,
71
+ })