stemcell_builder 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +20 -0
  2. data/.rvmrc +1 -0
  3. data/.travis.yml +1 -0
  4. data/Gemfile +14 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +123 -0
  7. data/Rakefile +10 -0
  8. data/assets/box.ovf.erb +81 -0
  9. data/assets/stemcell_mf_schema.yaml +30 -0
  10. data/bin/stemcell_builder +138 -0
  11. data/lib/stemcell.rb +3 -0
  12. data/lib/stemcell/builder.rb +445 -0
  13. data/lib/stemcell/builders/centos.rb +33 -0
  14. data/lib/stemcell/builders/redhat.rb +34 -0
  15. data/lib/stemcell/builders/ubuntu.rb +36 -0
  16. data/lib/stemcell/const.rb +12 -0
  17. data/lib/stemcell/version.rb +10 -0
  18. data/spec/spec_helper.rb +10 -0
  19. data/spec/stemcell_builder/builder_spec.rb +186 -0
  20. data/spec/stemcell_builder/centos_spec.rb +39 -0
  21. data/spec/stemcell_builder/redhat_spec.rb +53 -0
  22. data/spec/stemcell_builder/ubuntu_spec.rb +38 -0
  23. data/stemcell_builder.gemspec +42 -0
  24. data/templates/centos/_60-bosh-sysctl.conf +5 -0
  25. data/templates/centos/_empty_state.yml +9 -0
  26. data/templates/centos/_monitrc +8 -0
  27. data/templates/centos/_ntpdate +10 -0
  28. data/templates/centos/_runonce +46 -0
  29. data/templates/centos/_sysstat +18 -0
  30. data/templates/centos/_variables.sh.erb +31 -0
  31. data/templates/centos/base.sh +23 -0
  32. data/templates/centos/bosh_agent.sh +39 -0
  33. data/templates/centos/cleanup.sh +28 -0
  34. data/templates/centos/definition.rb.erb +37 -0
  35. data/templates/centos/harden.sh +8 -0
  36. data/templates/centos/ks.cfg +43 -0
  37. data/templates/centos/micro.sh +57 -0
  38. data/templates/centos/monit.sh +21 -0
  39. data/templates/centos/postinstall.sh +27 -0
  40. data/templates/centos/ruby.sh +42 -0
  41. data/templates/centos/setup-bosh.sh +20 -0
  42. data/templates/centos/sudo.sh +13 -0
  43. data/templates/centos/timestamp.sh +15 -0
  44. data/templates/centos/vmware-tools.sh +17 -0
  45. data/templates/centos/zerodisk.sh +9 -0
  46. data/templates/noop/erbtest.txt.erb +1 -0
  47. data/templates/noop/test.txt +1 -0
  48. data/templates/redhat/_60-bosh-sysctl.conf +5 -0
  49. data/templates/redhat/_empty_state.yml +9 -0
  50. data/templates/redhat/_monitrc +8 -0
  51. data/templates/redhat/_ntpdate +10 -0
  52. data/templates/redhat/_runonce +46 -0
  53. data/templates/redhat/_sysstat +18 -0
  54. data/templates/redhat/_variables.sh.erb +31 -0
  55. data/templates/redhat/base.sh +41 -0
  56. data/templates/redhat/bosh_agent.sh +37 -0
  57. data/templates/redhat/cleanup.sh +30 -0
  58. data/templates/redhat/definition.rb.erb +38 -0
  59. data/templates/redhat/harden.sh +8 -0
  60. data/templates/redhat/ks.cfg +86 -0
  61. data/templates/redhat/micro.sh +57 -0
  62. data/templates/redhat/monit.sh +21 -0
  63. data/templates/redhat/postinstall.sh +27 -0
  64. data/templates/redhat/rhnreg.sh.erb +15 -0
  65. data/templates/redhat/ruby.sh +42 -0
  66. data/templates/redhat/setup-bosh.sh +20 -0
  67. data/templates/redhat/sudo.sh +13 -0
  68. data/templates/redhat/timestamp.sh +15 -0
  69. data/templates/redhat/vmware-tools.sh +17 -0
  70. data/templates/redhat/zerodisk.sh +9 -0
  71. data/templates/ubuntu/_60-bosh-sysctl.conf +5 -0
  72. data/templates/ubuntu/_empty_state.yml +9 -0
  73. data/templates/ubuntu/_helpers.sh +40 -0
  74. data/templates/ubuntu/_monitrc +8 -0
  75. data/templates/ubuntu/_ntpdate +10 -0
  76. data/templates/ubuntu/_runonce +46 -0
  77. data/templates/ubuntu/_sysstat +18 -0
  78. data/templates/ubuntu/_variables.sh.erb +30 -0
  79. data/templates/ubuntu/apt-upgrade.sh +19 -0
  80. data/templates/ubuntu/base-stemcell.sh +95 -0
  81. data/templates/ubuntu/bosh_agent.sh +39 -0
  82. data/templates/ubuntu/definition.rb.erb +63 -0
  83. data/templates/ubuntu/harden.sh +9 -0
  84. data/templates/ubuntu/micro.sh +57 -0
  85. data/templates/ubuntu/monit.sh +22 -0
  86. data/templates/ubuntu/network-cleanup.sh +17 -0
  87. data/templates/ubuntu/postinstall.sh +45 -0
  88. data/templates/ubuntu/preseed.cfg +87 -0
  89. data/templates/ubuntu/ruby.sh +54 -0
  90. data/templates/ubuntu/setup-bosh.sh +14 -0
  91. data/templates/ubuntu/sudo.sh +14 -0
  92. data/templates/ubuntu/timestamp.sh +13 -0
  93. data/templates/ubuntu/vmware-tools.sh +22 -0
  94. data/templates/ubuntu/zero-disk.sh +10 -0
  95. metadata +375 -0
@@ -0,0 +1,95 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ source _helpers.sh
5
+ source _variables.sh
6
+
7
+ PACKAGES="build-essential,libssl-dev,lsof,strace,bind9-host,dnsutils,iputils-arping,curl,wget,libcurl3,bison,libreadline6-dev,libxml2,libxml2-dev,libxslt1.1,libxslt1-dev,zip,unzip,nfs-common,flex,psmisc,iptables,sysstat,rsync,openssh-server,libncurses5-dev,quota,libaio1,psmisc,dialog"
8
+ CHROOT=/tmp/chroot
9
+ [ -d $CHROOT ] && rm -rf $CHROOT && mkdir -p $CHROOT
10
+
11
+ ## Check if stemcell_base.tar.gz already exists
12
+ [ -f $bosh_app_dir/stemcell_base.tar.gz ] && exit 0
13
+
14
+ pushd /tmp
15
+ ARCH=$(dpkg --print-architecture)
16
+ debootstrap --make-tarball=debootstrap-squeeze-tarball.tar --arch=$ARCH --include=$PACKAGES squeeze $CHROOT
17
+ debootstrap --variant=minbase --unpack-tarball=/tmp/debootstrap-squeeze-tarball.tar squeeze $CHROOT
18
+ # Creates a pristine image to be run inside a warden container.
19
+ hostname="ubuntu.defaultdomain ubuntu"
20
+ rm -f $CHROOT/var/lib/apt/lists/{archive,security,lock}*
21
+
22
+ # Reconfigure timezone and locale
23
+ echo 'en_US.UTF-8 UTF-8' > $CHROOT/etc/locale.gen
24
+ echo 'UTC' > $CHROOT/etc/timezone
25
+ run_in_chroot $CHROOT "
26
+ dpkg-reconfigure -fnoninteractive libc6
27
+ dpkg-reconfigure -fnoninteractive locales
28
+ dpkg-reconfigure -fnoninteractive tzdata
29
+ "
30
+
31
+ # Fix /etc/mtab
32
+ run_in_chroot $CHROOT "ln -s /proc/mounts /etc/mtab"
33
+
34
+ # configure the network using the dhcp
35
+ cat <<EOF > $CHROOT/etc/network/interfaces
36
+ # This file describes the network interfaces available on your system
37
+ # and how to activate them. For more information, see interfaces(5).
38
+
39
+ # The loopback network interface
40
+ auto lo
41
+ iface lo inet loopback
42
+
43
+ auto eth0
44
+ iface eth0 inet dhcp
45
+ EOF
46
+
47
+ # set the hostname
48
+ cat <<EOF > $CHROOT/etc/hostname
49
+ $hostname
50
+ EOF
51
+ # set minimal hosts
52
+ cat <<EOF > $CHROOT/etc/hosts
53
+ 127.0.0.1 localhost
54
+ 127.0.1.1 $hostname
55
+
56
+ # The following lines are desirable for IPv6 capable hosts
57
+ ::1 ip6-localhost ip6-loopback
58
+ fe00::0 ip6-localnet
59
+ ff00::0 ip6-mcastprefix
60
+ ff02::1 ip6-allnodes
61
+ ff02::2 ip6-allrouters
62
+ EOF
63
+
64
+ # Install Firstboot script
65
+ cat <<EOF > $CHROOT/etc/rc.local
66
+ #!/bin/sh -e
67
+ #execute firstboot.sh only once
68
+ if [ ! -e /root/firstboot_done ]; then
69
+ if [ -e /root/firstboot.sh ]; then
70
+ /root/firstboot.sh
71
+ fi
72
+ touch /root/firstboot_done
73
+ fi
74
+ exit 0
75
+ EOF
76
+ cat <<EOF > $CHROOT/root/firstboot.sh
77
+ #!/bin/sh
78
+ rm /etc/resolv.conf
79
+ touch /etc/resolv.conf
80
+ rm /etc/ssh/ssh_host*key*
81
+ /etc/init.d/networking restart
82
+ dpkg-reconfigure -fnoninteractive -pcritical openssh-server
83
+ dpkg-reconfigure -fnoninteractive sysstat
84
+ EOF
85
+ chmod 0755 $CHROOT/root/firstboot.sh
86
+
87
+ # perform clean up
88
+ run_in_chroot $CHROOT "
89
+ apt-get clean
90
+ apt-get autoremove
91
+ "
92
+ echo "Creating base stemcell archive at $bosh_app_dir/stemcell_base.tar.gz"
93
+ tar -C $CHROOT -czf $bosh_app_dir/stemcell_base.tar.gz .
94
+ chmod 0700 $bosh_app_dir/stemcell_base.tar.gz
95
+ popd
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ source _variables.sh
5
+
6
+ mkdir -p /tmp/bosh_agent
7
+ echo -n $infrastructure > /etc/infrastructure
8
+
9
+ pushd /tmp/bosh_agent
10
+ cp $SRC_DIR/_bosh_agent.tar /tmp/bosh_agent
11
+ tar xmvf _bosh_agent.tar
12
+ $bosh_dir/bin/gem install *.gem --force --no-ri --no-rdoc
13
+ chmod +x $bosh_dir/bin/bosh_agent
14
+
15
+ # configure bosh agent
16
+ mkdir -p /etc/sv/agent/log
17
+ mkdir -p /var/vcap/bosh/log
18
+
19
+ echo '#!/bin/bash
20
+ export PATH=/var/vcap/bosh/bin:$PATH
21
+ exec 2>&1
22
+ exec /var/vcap/bosh/bin/bosh_agent --configure --infrastructure=`cat /etc/infrastructure` --platform=ubuntu
23
+ ' > /etc/sv/agent/run
24
+
25
+ echo '#!/bin/bash
26
+ svlogd -tt /var/vcap/bosh/log
27
+ ' > /etc/sv/agent/log/run
28
+
29
+ # runit
30
+ chmod +x /etc/sv/agent/run /etc/sv/agent/log/run
31
+
32
+ ln -s /etc/sv/agent /etc/service/agent
33
+
34
+ cp $SRC_DIR/_empty_state.yml $bosh_dir/state.yml
35
+
36
+ # The bosh agent installs a config that rotates on size
37
+ mv /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
38
+
39
+ popd
@@ -0,0 +1,63 @@
1
+ Veewee::Definition.declare({
2
+ :cpu_count => '1', :memory_size => '512',
3
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
4
+ :virtualbox => { :vm_options => ["pae" => "on", "ioapic" => "on"]},
5
+ :use_sata => false,
6
+ :os_type_id => 'Ubuntu_64',
7
+ :iso_file => "<%= @iso_filename %>",
8
+ :iso_src => "<%= @iso %>",
9
+ :iso_md5 => "<%= @iso_md5 %>",
10
+ :iso_download_timeout => "1000",
11
+ :boot_wait => "5", :boot_cmd_sequence => [
12
+ '<Esc><Esc><Enter>',
13
+ '/install/vmlinuz ',
14
+ 'initrd=/install/initrd.gz ',
15
+ 'noapic ',
16
+ 'fb=false ', # don't bother using a framebuffer
17
+ 'locale=en_US ', # Start installer in English
18
+ 'console-setup/ask_detect=false ', # Don't ask to detect keyboard
19
+ 'keyboard-configuration/layout=USA ', # set it to US qwerty
20
+ 'keyboard-configuration/variant=USA ',
21
+ 'hostname=%NAME% ', # Set the hostname
22
+ 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', # Fetch the rest from here
23
+ 'auto ',
24
+ 'debconf/frontend=noninteractive ',
25
+ 'debian-installer=en_US ',
26
+ 'kbd-chooser/method=us ',
27
+ '-- <Enter>'
28
+ ],
29
+
30
+ :kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "preseed.cfg",
31
+ :ssh_login_timeout => "10000", :ssh_user => "vcap", :ssh_password => "c1oudc0w", :ssh_key => "",
32
+ :ssh_host_port => "<%= @ssh_port %>", :ssh_guest_port => "22",
33
+ :sudo_cmd => "echo '%p'|sudo -S /bin/bash '%f'",
34
+ :shutdown_cmd => "shutdown -P now",
35
+ :postinstall_files => [
36
+ # Files with a leading _ are not executed
37
+ "_60-bosh-sysctl.conf",
38
+ "_monitrc",
39
+ "_ntpdate",
40
+ "_sysstat",
41
+ "_empty_state.yml",
42
+ "_variables.sh",
43
+ "_helpers.sh",
44
+ "_runonce",
45
+ "_bosh_agent.tar",
46
+ # The following scripts are run on the target vm one by one
47
+
48
+ "apt-upgrade.sh",
49
+ "timestamp.sh",
50
+ "sudo.sh",
51
+ "setup-bosh.sh",
52
+ "base-stemcell.sh",
53
+ "monit.sh",
54
+ "ruby.sh",
55
+ "bosh_agent.sh",
56
+ "vmware-tools.sh",
57
+ "network-cleanup.sh",
58
+ "zero-disk.sh",
59
+ "harden.sh",
60
+ "postinstall.sh",
61
+ ],
62
+ :postinstall_timeout => "10000"
63
+ })
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ ### stage bosh_harden
5
+ # remove setuid binaries - except su/sudo (sudoedit is hardlinked)
6
+ find / -xdev -perm +6000 -a -type f \
7
+ -a -not \( -name sudo -o -name su -o -name sudoedit \) \
8
+ -exec chmod ug-s {} \;
9
+
@@ -0,0 +1,57 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ bosh_app_dir=/var/vcap
5
+ bosh_dir=${bosh_app_dir}/bosh
6
+ infrastructure="vsphere"
7
+ SRC_DIR=`pwd`
8
+
9
+ blobstore_path=${bosh_app_dir}/micro_bosh/data/cache
10
+ agent_host=localhost
11
+ agent_port=6969
12
+ agent_uri=http://vcap:vcap@${agent_host}:${agent_port}
13
+ export PATH=${bosh_app_dir}/bosh/bin:$PATH
14
+
15
+ # Packages
16
+ apt-get -y install genisoimage libpq-dev nc g++ libboost-program-options-dev libboost-serialization-dev libpqclient-dev libmysqlclient-dev libsqlite3-dev
17
+
18
+ # Install package compiler
19
+ if [ ! -f "$bosh_dir/bin/package_compiler" ]
20
+ then
21
+ mkdir -p /tmp/package_compiler
22
+ pushd /tmp/package_compiler
23
+ cp $SRC_DIR/_package_compiler.tar .
24
+ tar -xvf _package_compiler.tar
25
+ $bosh_dir/bin/gem install *.gem --no-ri --no-rdoc --local
26
+ popd
27
+ fi
28
+
29
+ mkdir -p ${bosh_app_dir}/bosh/blob
30
+ mkdir -p ${blobstore_path}
31
+
32
+ echo "Starting micro bosh compilation"
33
+
34
+ # Start agent
35
+ $bosh_dir/bin/bosh_agent -I ${infrastructure} -n ${agent_uri} -s ${blobstore_path} -p local &
36
+ agent_pid=$!
37
+
38
+ # Wait for agent to come up
39
+ for i in {1..10}
40
+ do
41
+ nc -z ${agent_host} ${agent_port} && break
42
+ sleep 1
43
+ done
44
+
45
+ # Start compiler
46
+ $bosh_dir/bin/package_compiler --cpi ${infrastructure} compile $SRC_DIR/_release.yml $SRC_DIR/_release.tgz ${blobstore_path} ${agent_uri}
47
+
48
+ kill -15 $agent_pid
49
+
50
+ # Wait for agent
51
+ for i in {1..5}
52
+ do
53
+ kill -0 $agent_pid && break
54
+ sleep 1
55
+ done
56
+ # Force kill if required
57
+ kill -0 $agent_pid || kill -9 $agent_pid
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ source _variables.sh
5
+
6
+ apt-get -y install libpam-dev
7
+
8
+ ### stage bosh_monit
9
+ mkdir -p $bosh_dir/etc
10
+ cp $SRC_DIR/_monitrc $bosh_dir/etc/monitrc
11
+ chmod 0700 $bosh_dir/etc/monitrc
12
+
13
+ pushd /tmp
14
+ [ ! -f "monit-5.5.tar.gz" ] && wget http://mmonit.com/monit/dist/monit-5.5.tar.gz
15
+ tar xzvf monit-5.5.tar.gz
16
+ cd monit-5.5
17
+ ./configure --prefix=$bosh_dir --without-ssl
18
+ make && make install
19
+ # monit refuses to start without an include file present
20
+ mkdir -p $bosh_app_dir/monit
21
+ touch /$bosh_app_dir/monit/empty.monitrc
22
+ popd
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ # Removing leftover leases and persistent rules
5
+ echo "cleaning up dhcp leases"
6
+ rm /var/lib/dhcp3/*
7
+
8
+ # Make sure Udev doesn't block our network
9
+ # http://6.ptmc.org/?p=164
10
+ echo "cleaning up udev rules"
11
+ rm /etc/udev/rules.d/70-persistent-net.rules
12
+ mkdir /etc/udev/rules.d/70-persistent-net.rules
13
+ rm -rf /dev/.udev/
14
+ rm /lib/udev/rules.d/75-persistent-net-generator.rules
15
+
16
+ echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
17
+ echo "pre-up sleep 2" >> /etc/network/interfaces
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ #import helpers scripts
5
+ source _variables.sh
6
+
7
+ ### stage bosh_sysstat
8
+ cp $SRC_DIR/_sysstat /etc/default/sysstat
9
+
10
+ ### stage bosh_sysctl
11
+ cp $SRC_DIR/_60-bosh-sysctl.conf /etc/sysctl.d/60-bosh-sysctl.conf
12
+ chmod 0644 /etc/sysctl.d/60-bosh-sysctl.conf
13
+
14
+ ### stage bosh_ntpdate
15
+ # setup crontab for root to use ntpdate every 15 minutes
16
+ mkdir -p $bosh_dir/log
17
+ cp $SRC_DIR/_ntpdate $bosh_dir/bin/ntpdate
18
+ chmod 0755 $bosh_dir/bin/ntpdate
19
+ echo "0,15,30,45 * * * * ${bosh_dir}/bin/ntpdate" > /tmp/ntpdate.cron
20
+ crontab -u root /tmp/ntpdate.cron
21
+ rm /tmp/ntpdate.cron
22
+
23
+ ### stage micro_bosh ???
24
+
25
+ sed -i -e 's/^\(timeout=.*\)$/timeout=0/g' /boot/grub/menu.lst
26
+ sed -i -e 's/^\(timeout=.*\)$/timeout=0/g' /boot/grub/grub.conf
27
+
28
+
29
+ ### stage bosh_dpkg_list ??? How do we get back a list of things
30
+ # Create list of installed packages -- legal requirement
31
+ dpkg -l > $bosh_dir/stemcell_dpkg_l.out
32
+
33
+ # Clean out all the scripts
34
+ rm -f *.iso *.gem *.tar *.tgz
35
+
36
+ # install runonce
37
+ mkdir -p /etc/local/runonce.d/ran
38
+ cp $SRC_DIR/_runonce /usr/local/bin/runonce
39
+ chmod +x /usr/local/bin/runonce
40
+
41
+ # Do some firstboot clean up
42
+ # Regenerate ssh keys
43
+ /usr/local/bin/runonce "rm -f /etc/ssh/ssh_host_*"
44
+ /usr/local/bin/runonce "dpkg-reconfigure -fnoninteractive -pcritical openssh-server"
45
+
@@ -0,0 +1,87 @@
1
+ ## Options to set on the command line
2
+ d-i debian-installer/locale string en_US.utf8
3
+ d-i console-setup/ask_detect boolean false
4
+ d-i console-setup/layout string USA
5
+
6
+ #d-i netcfg/get_hostname string dummy
7
+ d-i netcfg/get_hostname string unassigned-hostname
8
+ d-i netcfg/get_domain string unassigned-domain
9
+
10
+ # Continue without a default route
11
+ # Not working , specify a dummy in the DHCP
12
+ #d-i netcfg/no_default_route boolean
13
+
14
+ d-i time/zone string UTC
15
+ d-i clock-setup/utc-auto boolean true
16
+ d-i clock-setup/utc boolean true
17
+
18
+ d-i kbd-chooser/method select American English
19
+
20
+ d-i netcfg/wireless_wep string
21
+
22
+ d-i base-installer/kernel/override-image string linux-virtual
23
+ #d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic
24
+
25
+ # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
26
+ d-i debconf debconf/frontend select Noninteractive
27
+
28
+ d-i pkgsel/install-language-support boolean false
29
+ tasksel tasksel/first multiselect standard, ubuntu-server
30
+
31
+ #d-i partman-auto/method string regular
32
+ d-i partman-auto/method string lvm
33
+ #d-i partman-auto/purge_lvm_from_device boolean true
34
+
35
+ d-i partman-lvm/confirm boolean true
36
+ d-i partman-lvm/device_remove_lvm boolean true
37
+ d-i partman-auto/choose_recipe select atomic
38
+
39
+ d-i partman/confirm_write_new_label boolean true
40
+ d-i partman/confirm_nooverwrite boolean true
41
+ d-i partman/choose_partition select finish
42
+ d-i partman/confirm boolean true
43
+
44
+ #http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883
45
+ #Message: "write the changes to disk and configure lvm preseed"
46
+ #http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input
47
+ #preseed partman-lvm/confirm_nooverwrite boolean true
48
+
49
+ # Write the changes to disks and configure LVM?
50
+ d-i partman-lvm/confirm boolean true
51
+ d-i partman-lvm/confirm_nooverwrite boolean true
52
+ d-i partman-auto-lvm/guided_size string max
53
+
54
+ ## Default user, we can get away with a recipe to change this
55
+ d-i passwd/user-fullname string vcap
56
+ d-i passwd/username string vcap
57
+ d-i passwd/user-password password c1oudc0w
58
+ d-i passwd/user-password-again password c1oudc0w
59
+ d-i user-setup/encrypt-home boolean false
60
+ d-i user-setup/allow-password-weak boolean true
61
+
62
+ ## minimum is puppet and ssh and ntp
63
+ # Individual additional packages to install
64
+ d-i pkgsel/include string openssh-server ntp
65
+
66
+ # Whether to upgrade packages after debootstrap.
67
+ # Allowed values: none, safe-upgrade, full-upgrade
68
+ d-i pkgsel/upgrade select full-upgrade
69
+
70
+ d-i grub-installer/only_debian boolean true
71
+ d-i grub-installer/with_other_os boolean true
72
+ d-i finish-install/reboot_in_progress note
73
+
74
+ #For the update
75
+ d-i pkgsel/update-policy select none
76
+
77
+ # debconf-get-selections --install
78
+ #Use mirror
79
+ #d-i apt-setup/use_mirror boolean true
80
+ #d-i mirror/country string manual
81
+ #choose-mirror-bin mirror/protocol string http
82
+ #choose-mirror-bin mirror/http/hostname string 192.168.4.150
83
+ #choose-mirror-bin mirror/http/directory string /ubuntu
84
+ #choose-mirror-bin mirror/suite select maverick
85
+ #d-i debian-installer/allow_unauthenticated string true
86
+
87
+ choose-mirror-bin mirror/http/proxy string
@@ -0,0 +1,54 @@
1
+ #!/bin/bash
2
+ set -x
3
+
4
+ source _variables.sh
5
+
6
+ ### stage bosh_ruby
7
+ apt-get -y update
8
+ apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev
9
+
10
+ # install libyaml
11
+ pushd /tmp
12
+ [ ! -f "yaml-0.1.4.tar.gz" ] && wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
13
+ tar zxf yaml-0.1.4.tar.gz
14
+ cd yaml-0.1.4
15
+ ./configure
16
+ make
17
+ make install
18
+ echo /usr/local/lib >> /etc/ld.so.conf
19
+ ldconfig
20
+ popd
21
+
22
+ # install ruby
23
+ pushd /tmp
24
+ if [ ! -f "$bosh_dir/bin/ruby" ]
25
+ then
26
+ [ ! -f "ruby-1.9.3-p374.tar.gz" ] && wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p374.tar.gz
27
+ tar zxf ruby-1.9.3-p374.tar.gz
28
+ cd ruby-1.9.3-p374
29
+ ./configure --prefix=$bosh_dir --disable-install-doc
30
+ make
31
+ make install
32
+ fi
33
+ popd
34
+ # Install rubygems
35
+ pushd /tmp
36
+ if [ ! -f "$bosh_dir/bin/gem" ]
37
+ then
38
+ [ ! -f "rubygems-1.8.24.tgz" ] && wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
39
+ tar zxf rubygems-1.8.24.tgz
40
+ cd rubygems-1.8.24
41
+ $bosh_dir/bin/ruby setup.rb --no-format-executable
42
+ fi
43
+ popd
44
+
45
+ echo "PATH=$bosh_dir/bin:$PATH" > /etc/environment
46
+ source /etc/environment
47
+
48
+ $bosh_dir/bin/gem update --system --no-ri --no-rdoc
49
+
50
+ mkdir -p $bosh_dir/etc
51
+ echo "gem: --no-rdoc --no-ri" >> $bosh_dir/etc/gemrc
52
+
53
+ #Install gems
54
+ $bosh_dir/bin/gem install bundler --no-ri --no-rdoc