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

Thomas Lange lange at informatik.uni-koeln.de
Thu Jan 21 17:53:30 CET 2010


>>>>> On Thu, 21 Jan 2010 17:34:44 +0100, Peter Bittner <peter.bittner at thalesgroup.com> said:

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

    > 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 ?

Create a script class/99-radeon:

#! /bin/bash

# skip if class XORG is not defined
grep -q XORG $FAI/class && exit 0

ATI_RADEON_ID=$(lspci | grep VGA | grep ATI | grep Radeon)
[ "$ATI_RADEON_ID" != "" ] && echo XORG_ATI


But the class XORG has to be defined before this script get executed.
Hope this helps.

-- 
regards Thomas


More information about the linux-fai mailing list