From: Tom Hughes Date: Mon, 16 May 2016 13:55:31 +0000 (+0100) Subject: Use systemd to manage serial getty on 16.04 machines X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/4a6b44b14090f10635726f05b07bb95c50dda83b Use systemd to manage serial getty on 16.04 machines --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 43c682ca0..aa0c88991 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -77,23 +77,29 @@ when "IBM" end units.sort.uniq.each do |unit| - file "/etc/init/ttySttyS#{unit}.conf" do - action :delete - end + if node[:lsb][:release].to_f >= 16.04 + service "serial-getty@ttyS#{unit}" do + action [:enable, :start] + end + else + file "/etc/init/ttySttyS#{unit}.conf" do + action :delete + end - template "/etc/init/ttyS#{unit}.conf" do - source "tty.conf.erb" - owner "root" - group "root" - mode 0644 - variables :unit => unit - end + template "/etc/init/ttyS#{unit}.conf" do + source "tty.conf.erb" + owner "root" + group "root" + mode 0644 + variables :unit => unit + end - service "ttyS#{unit}" do - provider Chef::Provider::Service::Upstart - action [:enable, :start] - supports :status => true, :restart => true, :reload => false - subscribes :restart, "template[/etc/init/ttyS#{unit}.conf]" + service "ttyS#{unit}" do + provider Chef::Provider::Service::Upstart + action [:enable, :start] + supports :status => true, :restart => true, :reload => false + subscribes :restart, "template[/etc/init/ttyS#{unit}.conf]" + end end end