Changes between Version 1 and Version 2 of FacterTweaks


Ignore:
Timestamp:
Mar 14, 2011 4:40:03 PM (14 years ago)
Author:
thomas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FacterTweaks

    v1 v2  
    44
    55This 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
     9require 'facter'
     10
     11Facter.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
     25end
     26}}}