forked from bobtfish/puppet-omnibus
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpuppet.rb
62 lines (51 loc) · 2.27 KB
/
puppet.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# depends on ruby being installed in /opt/puppet-omnibus/embedded by ruby-build
class PuppetGem < FPM::Cookery::Recipe
description 'Puppet gem stack'
# If you want to bump puppet version you have to do it in Gemfile as well
name 'puppet'
version ENV['PUPPET_VERSION']
source "nothing", :with => :noop
build_depends 'pkg-config', 'libxml2-dev', 'libxslt1-dev'
depends 'libxml2', 'libxslt1.1', 'virt-what'
def build
ENV['PKG_CONFIG_PATH'] = "#{destdir}/lib/pkgconfig"
cleanenv_safesystem "#{destdir}/bin/bundle config build.ruby-augeas \
--with-opt-dir=#{destdir}"
cleanenv_safesystem "#{destdir}/bin/bundle config --delete path"
cleanenv_safesystem "#{destdir}/bin/bundle install --local \
--gemfile #{workdir}/puppet/Gemfile \
--system"
cleanenv_safesystem "#{destdir}/bin/gem install #{workdir}/vendor/puppet-#{ENV['PUPPET_VERSION']}.gem"
# bundle is shit
cleanenv_safesystem <<-SHELL
for file in #{destdir}/bin/*; do
if head -n1 $file | grep '^#!/usr/bin/env ruby'; then
echo "Fixing shebang in $file"
sed -i '1s/.*/#!#{destdir.to_s.gsub('/', "\\/")}\\/bin\\/ruby/' $file
fi
done
for gemdir in `gem env GEM_HOME`/gems/*; do
[ -d $gemdir ] && rm -rf $gemdir/spec
done
SHELL
end
def install
# Provide 'safe' binaries in /opt/<package>/bin like Vagrant does
rm_rf "#{destdir}/../bin"
destdir('../bin').mkdir
destdir('../bin').install workdir('puppet/puppet'), 'puppet'
destdir('../bin').install workdir('shared/omnibus.bin'), 'facter'
destdir('../bin').install workdir('shared/omnibus.bin'), 'hiera'
destdir('../bin').install workdir('puppet/unicorn'), 'unicorn'
destdir('../var').mkdir
destdir('../var/lib').mkdir
destdir('../var/lib/ruby').mkdir
destdir('../var/lib/ruby').install workdir('puppet/gemspec_patch.rb')
destdir('../var/lib/ruby').install workdir('puppet/seppuku_patch.rb')
destdir('../var/lib/puppetmaster').mkdir
destdir('../var/lib/puppetmaster/rack').mkdir
destdir('../var/lib/puppetmaster/rack').install workdir('puppet/config.ru')
destdir('../etc').mkdir
destdir('../etc').install workdir('puppet/unicorn.conf')
end
end