summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2011-07-07 01:35:06 +0200
committermh <mh@immerda.ch>2011-07-07 01:35:06 +0200
commit4be11ed77eadf54dc98513c11ef9686be225c635 (patch)
tree0fbc72c348d3151580da7e78296e36c783a80c2a
parent9dba5a3ee02a10d5f308b444712367cab0be0ecf (diff)
downloadpuppet-ekeyd-4be11ed77eadf54dc98513c11ef9686be225c635.tar.gz
puppet-ekeyd-4be11ed77eadf54dc98513c11ef9686be225c635.tar.bz2
we cannot guarantee to have lsusb everywhere available
-rw-r--r--lib/facter/ekeyd.rb8
1 files changed, 7 insertions, 1 deletions
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