Last active
August 29, 2015 14:01
-
-
Save bixu/a8aec69a67b8c692c6c5 to your computer and use it in GitHub Desktop.
Wrapper script for building omnibus-chef for ubuntu LTS 12.0.4 with ruby 2.1.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| chef_version="11.12.8" | |
| if [ $(uname -a | grep -c Ubuntu) -eq 1 ]; then | |
| packager="apt-get" | |
| packages="build-essential git ruby1.9.1 ruby-bundler ruby1.9.1-dev" | |
| else | |
| packager="pkgin" | |
| packages="build-essential git ruby193-rubygems" | |
| fi | |
| sudo $packager -y update | |
| sudo $packager -y upgrade | |
| sudo $packager -y install $packages | |
| if [ ! -d ./omnibus-chef ]; then | |
| git clone https://github.com/opscode/omnibus-chef.git | |
| fi | |
| if [ -d /var/cache/omnibus ]; then | |
| sudo chown -R $(whoami) /var/cache/omnibus | |
| sudo chown -R $(whoami) /opt/chef | |
| fi | |
| echo "source 'https://rubygems.org' | |
| gem 'omnibus-software', :git => 'https://github.com/bixu/omnibus-software.git', | |
| :branch => 'master' | |
| gem 'omnibus', :git => 'https://github.com/bixu/omnibus-ruby.git', | |
| :branch => 'master'" > omnibus-chef/Gemfile | |
| echo "name \"chef\" | |
| friendly_name \"chef\" | |
| maintainer \"bixu\" | |
| homepage \"bixv.org\" | |
| build_iteration 1 | |
| build_version do | |
| # Use chef to determine the build version | |
| source :git, from_dependency: 'chef' | |
| # Set a Rubygems style version | |
| output_format :git_describe | |
| end | |
| install_path \"/opt/chef\" | |
| resources_path File.join(files_path, \"chef\") | |
| mac_pkg_identifier \"com.getchef.pkg.chef\" | |
| # You can pin the components to specific versions as below | |
| override :chef, version: \"11.12.8\" | |
| # override :ohai, version: \"7.0.4\" | |
| dependency \"preparation\" | |
| dependency \"chef\" | |
| dependency \"version-manifest\" | |
| " > omnibus-chef/config/projects/chef.rb | |
| sudo gem install bundler --no-ri --no-rdoc | |
| cd omnibus-chef | |
| bundle install --binstubs | |
| sudo mkdir -p /opt/chef | |
| sudo chown $(whoami) /opt/chef | |
| bundle install --binstubs | |
| sudo mkdir -p /var/cache/omnibus | |
| sudo chown $(whoami) /var/cache/omnibus | |
| git config --global user.email "$(whoami)@$(hostname)" | |
| git config --global user.name "$(whoami)" | |
| ./bin/omnibus build chef | |
| /opt/chef/embedded/bin/gem install chef -v $chef_version --no-ri --no-rdoc | |
| sudo chown -R root /opt/chef | |
| sudo chgrp -R root /opt/chef | |
| if [ $(echo `uname -a` | grep "^SunOS" | grep -c joyent) -eq 1 ]; then | |
| distro="smartos" | |
| elif [ $(echo `uname -a` | grep "^Linux" | grep -c buntu) -eq 1 ]; then | |
| distro="ubuntu" | |
| fi | |
| tar -zcvf omnibus-chef_$distro.tar.gz /opt/chef | |
| echo "your omnibus bundle is at ./omnibus-chef_$distro.tar.gz" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SmartOS builds currently fail thusly: