From 4be11ed77eadf54dc98513c11ef9686be225c635 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 7 Jul 2011 01:35:06 +0200 Subject: we cannot guarantee to have lsusb everywhere available --- lib/facter/ekeyd.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/facter/ekeyd.rb b/lib/facter/ekeyd.rb index 5a4417c..f15a304 100644 --- a/lib/facter/ekeyd.rb +++ b/lib/facter/ekeyd.rb @@ -1,5 +1,11 @@ Facter.add('ekeyd_key_present') do - confine :kernel => %w{Linux} + setcode do + FileTest.exists?('/proc/bus/usb/devices') && \ + !(File.read('/proc/bus/usb/devices') =~ /Product=Entropy Key/).nil? + end +end +Facter.add('ekeyd_key_present') do + confine :operatingsystem => %w{Debian} setcode do !`lsusb | grep "Entropy Key"`.empty? end -- cgit v1.2.3