stemcell_builder 1.0.8
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 +20 -0
- data/.rvmrc +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/Rakefile +10 -0
- data/assets/box.ovf.erb +81 -0
- data/assets/stemcell_mf_schema.yaml +30 -0
- data/bin/stemcell_builder +138 -0
- data/lib/stemcell.rb +3 -0
- data/lib/stemcell/builder.rb +445 -0
- data/lib/stemcell/builders/centos.rb +33 -0
- data/lib/stemcell/builders/redhat.rb +34 -0
- data/lib/stemcell/builders/ubuntu.rb +36 -0
- data/lib/stemcell/const.rb +12 -0
- data/lib/stemcell/version.rb +10 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/stemcell_builder/builder_spec.rb +186 -0
- data/spec/stemcell_builder/centos_spec.rb +39 -0
- data/spec/stemcell_builder/redhat_spec.rb +53 -0
- data/spec/stemcell_builder/ubuntu_spec.rb +38 -0
- data/stemcell_builder.gemspec +42 -0
- data/templates/centos/_60-bosh-sysctl.conf +5 -0
- data/templates/centos/_empty_state.yml +9 -0
- data/templates/centos/_monitrc +8 -0
- data/templates/centos/_ntpdate +10 -0
- data/templates/centos/_runonce +46 -0
- data/templates/centos/_sysstat +18 -0
- data/templates/centos/_variables.sh.erb +31 -0
- data/templates/centos/base.sh +23 -0
- data/templates/centos/bosh_agent.sh +39 -0
- data/templates/centos/cleanup.sh +28 -0
- data/templates/centos/definition.rb.erb +37 -0
- data/templates/centos/harden.sh +8 -0
- data/templates/centos/ks.cfg +43 -0
- data/templates/centos/micro.sh +57 -0
- data/templates/centos/monit.sh +21 -0
- data/templates/centos/postinstall.sh +27 -0
- data/templates/centos/ruby.sh +42 -0
- data/templates/centos/setup-bosh.sh +20 -0
- data/templates/centos/sudo.sh +13 -0
- data/templates/centos/timestamp.sh +15 -0
- data/templates/centos/vmware-tools.sh +17 -0
- data/templates/centos/zerodisk.sh +9 -0
- data/templates/noop/erbtest.txt.erb +1 -0
- data/templates/noop/test.txt +1 -0
- data/templates/redhat/_60-bosh-sysctl.conf +5 -0
- data/templates/redhat/_empty_state.yml +9 -0
- data/templates/redhat/_monitrc +8 -0
- data/templates/redhat/_ntpdate +10 -0
- data/templates/redhat/_runonce +46 -0
- data/templates/redhat/_sysstat +18 -0
- data/templates/redhat/_variables.sh.erb +31 -0
- data/templates/redhat/base.sh +41 -0
- data/templates/redhat/bosh_agent.sh +37 -0
- data/templates/redhat/cleanup.sh +30 -0
- data/templates/redhat/definition.rb.erb +38 -0
- data/templates/redhat/harden.sh +8 -0
- data/templates/redhat/ks.cfg +86 -0
- data/templates/redhat/micro.sh +57 -0
- data/templates/redhat/monit.sh +21 -0
- data/templates/redhat/postinstall.sh +27 -0
- data/templates/redhat/rhnreg.sh.erb +15 -0
- data/templates/redhat/ruby.sh +42 -0
- data/templates/redhat/setup-bosh.sh +20 -0
- data/templates/redhat/sudo.sh +13 -0
- data/templates/redhat/timestamp.sh +15 -0
- data/templates/redhat/vmware-tools.sh +17 -0
- data/templates/redhat/zerodisk.sh +9 -0
- data/templates/ubuntu/_60-bosh-sysctl.conf +5 -0
- data/templates/ubuntu/_empty_state.yml +9 -0
- data/templates/ubuntu/_helpers.sh +40 -0
- data/templates/ubuntu/_monitrc +8 -0
- data/templates/ubuntu/_ntpdate +10 -0
- data/templates/ubuntu/_runonce +46 -0
- data/templates/ubuntu/_sysstat +18 -0
- data/templates/ubuntu/_variables.sh.erb +30 -0
- data/templates/ubuntu/apt-upgrade.sh +19 -0
- data/templates/ubuntu/base-stemcell.sh +95 -0
- data/templates/ubuntu/bosh_agent.sh +39 -0
- data/templates/ubuntu/definition.rb.erb +63 -0
- data/templates/ubuntu/harden.sh +9 -0
- data/templates/ubuntu/micro.sh +57 -0
- data/templates/ubuntu/monit.sh +22 -0
- data/templates/ubuntu/network-cleanup.sh +17 -0
- data/templates/ubuntu/postinstall.sh +45 -0
- data/templates/ubuntu/preseed.cfg +87 -0
- data/templates/ubuntu/ruby.sh +54 -0
- data/templates/ubuntu/setup-bosh.sh +14 -0
- data/templates/ubuntu/sudo.sh +14 -0
- data/templates/ubuntu/timestamp.sh +13 -0
- data/templates/ubuntu/vmware-tools.sh +22 -0
- data/templates/ubuntu/zero-disk.sh +10 -0
- metadata +375 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [[ $# -eq 0 ]]; then
|
4
|
+
echo "Schedules a command to be run after the next reboot."
|
5
|
+
echo "Usage: $(basename $0) <command>"
|
6
|
+
echo " $(basename $0) -p <path> <command>"
|
7
|
+
echo " $(basename $0) -r <command>"
|
8
|
+
else
|
9
|
+
REMOVE=0
|
10
|
+
COMMAND=${!#}
|
11
|
+
SCRIPTPATH=$PATH
|
12
|
+
|
13
|
+
while getopts ":r:p:" optionName; do
|
14
|
+
case "$optionName" in
|
15
|
+
r) REMOVE=1; COMMAND=$OPTARG;;
|
16
|
+
p) SCRIPTPATH=$OPTARG;;
|
17
|
+
esac
|
18
|
+
done
|
19
|
+
|
20
|
+
SCRIPT="${HOME}/.$(basename $0)_$(echo $COMMAND | sed 's/[^a-zA-Z0-9_]/_/g')"
|
21
|
+
|
22
|
+
if [[ ! -f $SCRIPT ]]; then
|
23
|
+
echo "PATH=$SCRIPTPATH" >> $SCRIPT
|
24
|
+
echo "cd $(pwd)" >> $SCRIPT
|
25
|
+
echo "logger -t $(basename $0) -p local3.info \"COMMAND=$COMMAND ; USER=\$(whoami) ($(logname)) ; PWD=$(pwd) ; PATH=\$PATH\"" >> $SCRIPT
|
26
|
+
echo "$COMMAND | logger -t $(basename $0) -p local3.info" >> $SCRIPT
|
27
|
+
echo "$0 -r \"$(echo $COMMAND | sed 's/\"/\\\"/g')\"" >> $SCRIPT
|
28
|
+
chmod +x $SCRIPT
|
29
|
+
fi
|
30
|
+
|
31
|
+
CRONTAB="${HOME}/.$(basename $0)_temp_crontab_$RANDOM"
|
32
|
+
ENTRY="@reboot $SCRIPT"
|
33
|
+
|
34
|
+
echo "$(crontab -l 2>/dev/null)" | grep -v "$ENTRY" | grep -v "^# DO NOT EDIT THIS FILE - edit the master and reinstall.$" | grep -v "^# ([^ ]* installed on [^)]*)$" | grep -v "^# (Cron version [^$]*\$[^$]*\$)$" > $CRONTAB
|
35
|
+
|
36
|
+
if [[ $REMOVE -eq 0 ]]; then
|
37
|
+
echo "$ENTRY" >> $CRONTAB
|
38
|
+
fi
|
39
|
+
|
40
|
+
crontab $CRONTAB
|
41
|
+
rm $CRONTAB
|
42
|
+
|
43
|
+
if [[ $REMOVE -ne 0 ]]; then
|
44
|
+
rm $SCRIPT
|
45
|
+
fi
|
46
|
+
fi
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
|
3
|
+
# and /etc/cron.daily/sysstat files
|
4
|
+
#
|
5
|
+
|
6
|
+
# Should sadc collect system activity informations? Valid values
|
7
|
+
# are "true" and "false". Please do not put other values, they
|
8
|
+
# will be overwritten by debconf!
|
9
|
+
ENABLED="true"
|
10
|
+
|
11
|
+
# Additional options passed to sa1 by /etc/init.d/sysstat
|
12
|
+
# and /etc/cron.d/sysstat
|
13
|
+
# By default contains the `-S DISK' option responsible for
|
14
|
+
# generating disk statisitcs.
|
15
|
+
SA1_OPTIONS="-S DISK"
|
16
|
+
|
17
|
+
# Additional options passed to sa2 by /etc/cron.daily/sysstat.
|
18
|
+
SA2_OPTIONS=""
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
bosh_app_dir=/var/vcap
|
4
|
+
bosh_dir=$bosh_app_dir/bosh
|
5
|
+
bosh_users_password="c1owdc0w"
|
6
|
+
infrastructure="vsphere"
|
7
|
+
SRC_DIR=`pwd`
|
8
|
+
|
9
|
+
if [ ! -d "$bosh_dir" ]; then
|
10
|
+
# create bosh_dir and add to path
|
11
|
+
mkdir -p $bosh_dir
|
12
|
+
echo "PATH=$PATH:$bosh_dir/bin
|
13
|
+
export PATH
|
14
|
+
" >> /etc/profile
|
15
|
+
|
16
|
+
echo "PATH=$PATH:$bosh_dir/bin
|
17
|
+
export PATH
|
18
|
+
" >> /root/.bash_profile
|
19
|
+
|
20
|
+
export PATH=$PATH:$bosh_dir/bin
|
21
|
+
fi
|
22
|
+
|
23
|
+
<% if ENV['HTTP_PROXY'] || ENV['http_proxy'] %>
|
24
|
+
export HTTP_PROXY=<%= ENV['HTTP_PROXY'] || ENV['http_proxy'] %>
|
25
|
+
export http_proxy=<%= ENV['HTTP_PROXY'] || ENV['http_proxy'] %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% if ENV['HTTPS_PROXY'] || ENV['https_proxy'] %>
|
29
|
+
export HTTPS_PROXY=<%= ENV['HTTPS_PROXY'] || ENV['https_proxy'] %>
|
30
|
+
export https_proxy=<%= ENV['HTTPS_PROXY'] || ENV['https_proxy'] %>
|
31
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
|
5
|
+
source _variables.sh
|
6
|
+
|
7
|
+
# Base install
|
8
|
+
rpm -U --nosignature http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
|
9
|
+
rpm -U --nosignature http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
|
10
|
+
|
11
|
+
#yum -y groupinstall "Development Tools"
|
12
|
+
yum -y install sudo gcc make gcc-c++ kernel-devel-`uname -r` zlib-devel openssl-devel \
|
13
|
+
readline-devel sqlite-devel perl wget dkms curl ntp crontabs sysstat eject dash
|
14
|
+
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel \
|
15
|
+
openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git postgresql-devel
|
16
|
+
|
17
|
+
/usr/sbin/groupadd vcap
|
18
|
+
/usr/sbin/groupadd admin
|
19
|
+
/usr/sbin/useradd vcap -g vcap -G wheel
|
20
|
+
echo "c1oudc0w" | passwd --stdin vcap
|
21
|
+
echo "vcap ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vcap
|
22
|
+
chmod 0440 /etc/sudoers.d/vcap
|
23
|
+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
source _variables.sh
|
4
|
+
|
5
|
+
echo -n $infrastructure > /etc/infrastructure
|
6
|
+
|
7
|
+
mkdir -p /tmp/bosh_agent
|
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=rhel
|
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
|
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,28 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
|
5
|
+
source _variables.sh
|
6
|
+
|
7
|
+
yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
|
8
|
+
yum -y clean all
|
9
|
+
|
10
|
+
# install runonce
|
11
|
+
mkdir -p /etc/local/runonce.d/ran
|
12
|
+
cp $SRC_DIR/_runonce /usr/local/bin/runonce
|
13
|
+
chmod +x /usr/local/bin/runonce
|
14
|
+
|
15
|
+
sed -i -e 's/^\(HWADDR=.*\)$//g' /etc/sysconfig/network-scripts/ifcfg-eth*
|
16
|
+
rm -f /etc/udev/rules.d/70-persistent-net.rules
|
17
|
+
|
18
|
+
# remove grub delat
|
19
|
+
sed -i -e 's/^\(timeout=.*\)$/timeout=0/g' /boot/grub/menu.lst
|
20
|
+
sed -i -e 's/^\(timeout=.*\)$/timeout=0/g' /boot/grub/grub.conf
|
21
|
+
# Do some firstboot clean up
|
22
|
+
# Regenerate ssh keys
|
23
|
+
/usr/local/bin/runonce "rm -f /etc/ssh/ssh_host_*"
|
24
|
+
/usr/local/bin/runonce "ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''"
|
25
|
+
/usr/local/bin/runonce "ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''"
|
26
|
+
|
27
|
+
# Clean out all the scripts
|
28
|
+
rm -f *.iso *.gem *.tar *.tgz
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Veewee::Session.declare({
|
2
|
+
:cpu_count => '1', :memory_size=> '480',
|
3
|
+
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :use_sata => false,
|
4
|
+
:os_type_id => 'RedHat_64',
|
5
|
+
:iso_file => "<%= @iso_filename %>", :iso_src => "<%= @iso %>", :iso_md5 => "<%= @iso_md5 %>",
|
6
|
+
:iso_download_timeout => 5000,
|
7
|
+
:boot_wait => "5", :boot_cmd_sequence => ['<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'],
|
8
|
+
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
|
9
|
+
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "c1oudc0w", :ssh_key => "",
|
10
|
+
:ssh_host_port => "<%= @ssh_port %>", :ssh_guest_port => "22",
|
11
|
+
:sudo_cmd => "echo '%p'|/bin/bash '%f'", :shutdown_cmd => "/sbin/halt -h -p",
|
12
|
+
:postinstall_files => [
|
13
|
+
"_60-bosh-sysctl.conf",
|
14
|
+
"_monitrc",
|
15
|
+
"_ntpdate",
|
16
|
+
"_sysstat",
|
17
|
+
"_empty_state.yml",
|
18
|
+
"_variables.sh",
|
19
|
+
"_monitrc",
|
20
|
+
"_runonce",
|
21
|
+
"_bosh_agent.tar",
|
22
|
+
|
23
|
+
"base.sh",
|
24
|
+
"timestamp.sh",
|
25
|
+
"sudo.sh",
|
26
|
+
"setup-bosh.sh",
|
27
|
+
"monit.sh",
|
28
|
+
"ruby.sh",
|
29
|
+
"bosh_agent.sh",
|
30
|
+
"vmware-tools.sh",
|
31
|
+
"harden.sh",
|
32
|
+
"postinstall.sh",
|
33
|
+
"zerodisk.sh",
|
34
|
+
"cleanup.sh"
|
35
|
+
],
|
36
|
+
:postinstall_timeout => 10000
|
37
|
+
})
|
@@ -0,0 +1,43 @@
|
|
1
|
+
install
|
2
|
+
cdrom
|
3
|
+
lang en_US.UTF-8
|
4
|
+
keyboard us
|
5
|
+
network --bootproto=dhcp
|
6
|
+
rootpw c1oudc0w
|
7
|
+
authconfig --enableshadow --passalgo=sha512
|
8
|
+
selinux --disabled
|
9
|
+
firewall --disable
|
10
|
+
timezone UTC
|
11
|
+
bootloader --location=mbr
|
12
|
+
|
13
|
+
cmdline
|
14
|
+
skipx
|
15
|
+
zerombr
|
16
|
+
|
17
|
+
clearpart --all --initlabel
|
18
|
+
autopart
|
19
|
+
|
20
|
+
auth --useshadow --enablemd5
|
21
|
+
firstboot --disabled
|
22
|
+
reboot
|
23
|
+
|
24
|
+
%packages --ignoremissing
|
25
|
+
@core
|
26
|
+
kernel-devel
|
27
|
+
kernel-headers
|
28
|
+
gcc
|
29
|
+
gcc-c++
|
30
|
+
bzip2
|
31
|
+
make
|
32
|
+
pam-devel
|
33
|
+
zlib-devel
|
34
|
+
openssl-devel
|
35
|
+
readline-devel
|
36
|
+
sqlite-devel
|
37
|
+
-ipw2100-firmware
|
38
|
+
-ipw2200-firmware
|
39
|
+
-ivtv-firmware
|
40
|
+
sudo
|
41
|
+
|
42
|
+
%end
|
43
|
+
|
@@ -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
|
+
yum -y install mkisofs genisoimage postgresql-libs postgresql-devel boost boost-devel mysql mysql-devel lua lua-devel nc
|
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 2 3 4 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,21 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
source _variables.sh
|
4
|
+
|
5
|
+
### stage bosh_monit
|
6
|
+
mkdir -p $bosh_dir/etc
|
7
|
+
cp _monitrc $bosh_dir/etc/monitrc
|
8
|
+
chmod 0700 $bosh_dir/etc/monitrc
|
9
|
+
|
10
|
+
yum -y install pam-devel
|
11
|
+
|
12
|
+
pushd /tmp
|
13
|
+
[ ! -f "monit-5.5.tar.gz" ] && wget http://mmonit.com/monit/dist/monit-5.5.tar.gz
|
14
|
+
tar xzvf monit-5.5.tar.gz
|
15
|
+
cd monit-5.5
|
16
|
+
./configure --prefix=$bosh_dir --without-ssl
|
17
|
+
make && make install
|
18
|
+
# monit refuses to start without an include file present
|
19
|
+
mkdir -p $bosh_app_dir/monit
|
20
|
+
touch /$bosh_app_dir/monit/empty.monitrc
|
21
|
+
popd
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#import helpers scripts
|
4
|
+
source _variables.sh
|
5
|
+
|
6
|
+
### stage bosh_sysstat
|
7
|
+
cp $SRC_DIR/_sysstat /etc/default/sysstat
|
8
|
+
|
9
|
+
### stage bosh_sysctl
|
10
|
+
[ ! -d /etc/sysctl.d ] && mkdir -p /etc/sysctl.d
|
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
|
+
# Final system update
|
24
|
+
yum -y update
|
25
|
+
|
26
|
+
# Create list of installed packages -- legal requirement
|
27
|
+
yum list installed > $bosh_dir/stemcell_yum_list_installed.out
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
|
5
|
+
source _variables.sh
|
6
|
+
|
7
|
+
# install libyaml
|
8
|
+
pushd /tmp
|
9
|
+
[ ! -f "yaml-0.1.4.tar.gz" ] && wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
|
10
|
+
tar zxf yaml-0.1.4.tar.gz
|
11
|
+
cd yaml-0.1.4
|
12
|
+
./configure
|
13
|
+
make
|
14
|
+
make install
|
15
|
+
echo /usr/local/lib >> /etc/ld.so.conf
|
16
|
+
ldconfig
|
17
|
+
popd
|
18
|
+
|
19
|
+
# install ruby and rubygems
|
20
|
+
pushd /tmp
|
21
|
+
[ ! -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
|
22
|
+
tar zxf ruby-1.9.3-p374.tar.gz
|
23
|
+
cd ruby-1.9.3-p374
|
24
|
+
./configure --prefix=$bosh_dir --disable-install-doc
|
25
|
+
make
|
26
|
+
make install
|
27
|
+
popd
|
28
|
+
|
29
|
+
pushd /tmp
|
30
|
+
[ ! -f "rubygems-1.8.24.tgz" ] && wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
|
31
|
+
tar zxf rubygems-1.8.24.tgz
|
32
|
+
cd rubygems-1.8.24
|
33
|
+
$bosh_dir/bin/ruby setup.rb --no-format-executable
|
34
|
+
popd
|
35
|
+
|
36
|
+
export PATH=$PATH:$bosh_dir/bin
|
37
|
+
$bosh_dir/bin/gem update --system --no-ri --no-rdoc
|
38
|
+
mkdir -p $bosh_dir/etc
|
39
|
+
echo "gem: --no-rdoc --no-ri" >> $bosh_dir/etc/gemrc
|
40
|
+
|
41
|
+
# Install bundler gem
|
42
|
+
$bosh_dir/bin/gem install bundler --no-ri --no-rdoc
|