From: Tom Hughes Date: Mon, 5 Oct 2015 15:15:17 +0000 (+0100) Subject: Cope with newer kernels that put coretemp input in a different place X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/98c7efd2865cf1842f3b937e63f5cee11f455d3a?ds=sidebyside Cope with newer kernels that put coretemp input in a different place --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 9e1af16ef..bb7de4a98 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -540,9 +540,15 @@ unless Dir.glob("/sys/class/hwmon/hwmon*").empty? cpu = File.basename(coretemp).sub("coretemp.", "").to_i chip = format("coretemp-isa-%04d", cpu) - temps = Dir.glob("#{coretemp}/temp*_input").map do |temp| - File.basename(temp).sub("temp", "").sub("_input", "").to_i - end.sort + if File.exist?("#{coretemp}/name") + temps = Dir.glob("#{coretemp}/temp*_input").map do |temp| + File.basename(temp).sub("temp", "").sub("_input", "").to_i + end.sort + else + temps = Dir.glob("#{coretemp}/hwmon/hwmon*/temp*_input").map do |temp| + File.basename(temp).sub("temp", "").sub("_input", "").to_i + end.sort + end if temps.first == 1 node.default[:hardware][:sensors][chip][:temps][:temp1][:label] = "CPU #{cpu}"