Skip to content

Commit

Permalink
Merge pull request #17 from msedlmairHH/master
Browse files Browse the repository at this point in the history
Fix systemd detection for Ubuntu 18.04 support
  • Loading branch information
JTabel authored Jan 25, 2019
2 parents 9b397fb + 5985c11 commit ea21db0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.4.3 / 2018.12.11
* [ENHANCEMENT] Use systemd if installed. There's no /sbin/init in Ubuntu 18.04.
* [TESTS] Added spec tests for Ubuntu 18.04

# 0.4.2 / 2018.12.11
* [ENHANCEMENT] added option to set the tmpdir path for source files

Expand Down
2 changes: 1 addition & 1 deletion fpm-fry.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |gem|
gem.name = 'fpm-fry'
gem.version = '0.4.2'
gem.version = '0.4.3'
gem.date = Time.now.strftime("%Y-%m-%d")

gem.summary = "FPM Fry"
Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/fry/plugin/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def init

private
def self.detect(inspector)
if inspector.link_target('/sbin/init') == '/lib/systemd/systemd'
if inspector.exists?('/lib/systemd/systemd')
return System.new(:systemd, {})
end
if inspector.exists?('/etc/init')
Expand Down
28 changes: 28 additions & 0 deletions spec/detector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,34 @@

end

context 'with ubuntu:18.04' do

let(:result) do
result = nil
with_inspector('ubuntu:18.04') do |inspector|
result = Detector.detect(inspector)
end
result
end

it 'finds ubuntu' do
expect(result[:distribution]).to eq('ubuntu')
end

it 'finds release 18.04' do
expect(result[:release]).to eq('18.04')
end

it 'finds codename bionic' do
expect(result[:codename]).to eq('bionic')
end

it 'finds flavour debian' do
expect(result[:flavour]).to eq('debian')
end

end

context 'with ubuntu:16.04' do

let(:result) do
Expand Down
10 changes: 9 additions & 1 deletion spec/plugin/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@
builder.plugin('init')
expect(builder.init).to be_a FPM::Fry::Plugin::Init::System
end

end

context 'init detection (real)' do
context 'with ubuntu:18.04' do
skip 'finds systemd' do
with_inspector('ubuntu:18.04') do |insp|
builder = FPM::Fry::Recipe::Builder.new({},inspector: insp)
builder.extend(FPM::Fry::Plugin::Init)
expect(builder.init).to be_systemd
end
end
end

context 'with ubuntu:16.04' do
it 'finds systemd' do
Expand Down

0 comments on commit ea21db0

Please sign in to comment.