| Version 3 (modified by thomas, 15 years ago) (diff) |
|---|
Facter Tweaks
videocard fact
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. Place in /usr/lib/ruby/site_ruby/1.8/facter/videocard.rb
# Josko Plazonic - lifted from Josko March 14, 2011 by Thomas Uphill
require 'facter'
Facter.add("videocard") do
confine :kernel => :linux
ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
setcode do
controllers = []
lspciexists = system "/bin/bash -c 'which lspci >&/dev//null'"
if $?.exitstatus == 0
output = %x{lspci}
output.each {|s|
controllers.push($1) if s =~ /VGA compatible controller: (.*)/
}
end
controllers
end
end
After installing you should be able to see the fact like so:
[root@host ~]# facter |grep video videocard => Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02) [root@host ~]#
