Changes between Version 1 and Version 2 of FacterTweaks
- Timestamp:
- Mar 14, 2011 4:40:03 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FacterTweaks
v1 v2 4 4 5 5 This ruby snippet adds a videocard fact to facter. You can use this fact to decide if you need to install any proprietary video card drivers. 6 {{{ 7 #!ruby 8 # Josko Plazonic - lifted from Josko March 14, 2011 by Thomas Uphill 9 require 'facter' 10 11 Facter.add("videocard") do 12 confine :kernel => :linux 13 ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" 14 setcode do 15 controllers = [] 16 lspciexists = system "/bin/bash -c 'which lspci >&/dev//null'" 17 if $?.exitstatus == 0 18 output = %x{lspci} 19 output.each {|s| 20 controllers.push($1) if s =~ /VGA compatible controller: (.*)/ 21 } 22 end 23 controllers 24 end 25 end 26 }}}