Skip to content

Instantly share code, notes, and snippets.

@marthag
Created July 22, 2012 14:15
Show Gist options
  • Save marthag/3159828 to your computer and use it in GitHub Desktop.
Save marthag/3159828 to your computer and use it in GitHub Desktop.
knife bootstrap file for chef on solaris 5.10 x86
bash -c '
export PATH=/opt/csw/bin:/usr/sfw/bin:/usr/local/bin:/usr/sbin:/usr/bin
if [ ! -f /.profile ] ; then
echo "creating initial .profile"
echo -e "PATH=/opt/csw/bin:/usr/sfw/bin:/usr/local/bin:/usr/sbin:/usr/bin\nexport PATH" >> /.profile
fi
if [ ! -f /var/ld/ld.config ]; then
crle -u -l /opt/csw/lib -l /usr/local/lib
fi
if [ ! -f /var/sadm/install/admin/auto-install ]; then
echo -e "mail=\ninstance=overwrite\npartial=nocheck\nrunlevel=nocheck\nidepend=nocheck\nrdepend=nocheck\nspace=nocheck\nsetuid=nocheck\nconflict=nocheck\naction=nocheck\nbasedir=default" >> /var/sadm/install/admin/auto-install
fi
if [ ! -f /opt/csw/bin/pkgutil ]; then
echo "installing pkgutil from opencsw"
pkgadd -n -a /var/sadm/install/admin/auto-install -d http://get.opencsw.org/now CSWpkgutil
fi
if ! grep opencsw/unstable /etc/opt/csw/pkgutil.conf >& /dev/null; then
echo "mirror=http://mirror.opencsw.org/opencsw/unstable" >> /etc/opt/csw/pkgutil.conf
fi
if [ ! -f /opt/csw/bin/gmake ]; then
echo "installing csw packages"
/opt/csw/bin/pkgutil -y -i libgcc_s1 coreutils libssl1_0_0 wget gsed binutils gmake
fi
if [ ! -d /usr/local ] ; then
mkdir /usr/local
fi
if [ ! -f /usr/local/bin/ruby ]; then
cd /usr/src/
echo "getting SMC packages"
wget http://www.sunfreeware.com/intel/10/ruby-1.9.2p0-sol10-x86-local.gz
gunzip *.gz
echo "installing SMC packages"
pkgadd -n -a /var/sadm/install/admin/auto-install -d ruby-1.9.2p0-sol10-x86-local SMCruby
fi
if [ ! -L /usr/local/bin/make ]; then
ln -s /opt/csw/bin/gmake /usr/local/bin/make
fi
if [ ! -L /usr/local/bin/ld ]; then
ln -s /opt/csw/bin/gld /usr/local/bin/ld
fi
if [ -f /usr/ccs/bin/ld ]; then
mv /usr/ccs/bin/ld /usr/ccs/bin/ld.sun
fi
if [ ! -L /usr/local/bin/ginstall ]; then
ln -s /opt/csw/bin/ginstall /usr/local/bin/ginstall
fi
if [ ! -L /usr/local/bin/mkdir ]; then
ln -s /usr/bin/mkdir /usr/local/bin/mkdir
fi
if [ ! -f /usr/local/bin/chef-client ]; then
echo "installing chef"
gem install ohai --no-rdoc --no-ri --verbose
gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
fi
if ! grep solaris2 /usr/local/lib/ruby/gems/1.9.1/gems/chef-<%= chef_version %>/lib/chef/provider/group/usermod.rb >& /dev/null; then
echo "patching chef"
gsed -i "s/\"aix\"/\"aix\", \"solaris2\"/" /usr/local/lib/ruby/gems/1.9.1/gems/chef-<%= chef_version %>/lib/chef/provider/group/usermod.rb
fi
mkdir -p /etc/chef
(
cat <<'EOP'
<%= validation_key %>
EOP
) > /tmp/validation.pem
cat /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
<%= config_content %>
EOP
) > /etc/chef/client.rb
(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json
if [ `zonename` == "global" ]; then
ntpdate pool.ntp.org
fi
<%= start_chef %>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment