Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix systemd detection for Ubuntu 18.04 support #17

Merged
merged 3 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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