How to conditionally define a class? (ex. Xorg configuration)

Peter Bittner peter.bittner at thalesgroup.com
Thu Jan 21 17:34:44 CET 2010


(Probably the solution to this is simple, I haven't just figured it out,
sorry...)

I want to install some software based on a condition of the target
hardware. Specifically, I want to install a Debian package (here:
fglrx-driver) if and only if an ATI Radeon graphics card is installed.
The code could be something like this:

  ATI_RADEON_ID=$(lspci | grep VGA | grep ATI | grep Radeon)
  [ "$ATI_RADEON_ID" != "" ] && apt-get -y install fglrx-driver

Of course, there are dependencies that I want to be resolved
automatically, specifically it must work with an offline repository
(that I create using fai-mirror). To ensure that fai-mirror takes care
of all the dependencies I need to come up with a FAI class (say:
XORG_ATI).

Now the question is: Instead of running apt-get as above, how can I
define the class XORG_ATI dynamically at installation time (if and only
if the XORG class is defined!) in order to install the software packages
listed in var/lib/fai/config/package_config/XORG_ATI ?

Thanks in advance for any hint,
Peter


More information about the linux-fai mailing list