Version 2 (modified by thomas, 14 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.
# 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