diff --git a/Rakefile b/Rakefile index ca0b29a..f073a33 100644 --- a/Rakefile +++ b/Rakefile @@ -8,4 +8,3 @@ Rake::TestTask.new do |t| end task :default => [:test] - diff --git a/build/Gemfile b/build/Gemfile index 7465e52..26488e4 100644 --- a/build/Gemfile +++ b/build/Gemfile @@ -3,3 +3,4 @@ source 'https://rubygems.org' # Install omnibus software gem 'omnibus', github: 'servebox/omnibus', branch: 'package-name-override' gem 'omnibus-software', github: 'servebox/omnibus-software', branch: 'pin-cacerts' +gem 'git_rev' diff --git a/build/config/software/electric_sheep.rb b/build/config/software/electric_sheep.rb index e7a3b1a..cc55653 100644 --- a/build/config/software/electric_sheep.rb +++ b/build/config/software/electric_sheep.rb @@ -1,4 +1,5 @@ require File.join(File.dirname(__FILE__), '../build') +require 'git_rev' name "electric_sheep" @@ -13,12 +14,13 @@ relative_path "electric_sheep" build do + revision = GitRev::Sha.new(repository: packaging_directories[:root]).full env = with_standard_compiler_flags(with_embedded_path) gem "build electric_sheep.gemspec", env: env gem "install electric_sheep-#{ElectricSheep::VERSION}.gem \ -n #{install_dir}/bin --no-ri --no-rdoc", env: env erb source: 'ruby_wrapper.erb', dest: "#{install_dir}/bin/ruby_wrapper", - vars: {install_dir: install_dir}, + vars: {install_dir: install_dir, revision: revision}, mode: 0755 end diff --git a/build/config/templates/electric_sheep/ruby_wrapper.erb b/build/config/templates/electric_sheep/ruby_wrapper.erb index f23b040..07e3cc6 100644 --- a/build/config/templates/electric_sheep/ruby_wrapper.erb +++ b/build/config/templates/electric_sheep/ruby_wrapper.erb @@ -5,4 +5,6 @@ export RUBY_GC_MALLOC_LIMIT_MAX=16777216 export RUBY_GC_OLDMALLOC_LIMIT_MIN=16777216 export RUBY_GC_OLDMALLOC_LIMIT_MAX=33554432 +export ELECTRIC_SHEEP_REVISION=<%= revision %> + exec <%= install_dir %>/embedded/bin/ruby <%= install_dir %>/bin/electric_sheep "$@"