hiya

I'd like fai to decide which packages to install on a given host to be a bit more customizable. At least I think so. There may be a different way, which I'm to blind to see.

[Note: I'm using the same config-space for debian / ubuntu / 32bit / 64bit. I'm using 4 different nfsroots for debian 32, debian 64, ubuntu 32 and ubuntu64. By calling lsb_release in the nfsroot it's possible to figure out which OS is requested for installation. I'm currently pondering whether to use just a 32bit and a 64bit nfsroot and deliver the decision which OS to install via a kernel parameter. I'm booting the machines via PXE.]

Okay, I have played around a bit with classes and here's the following scenario:

If the installation client is supposed to be a debian 32 bit box, then the class "DEBIAN32" get's set. If it's 64bit, then DEBIAN64, same with UBUNTU32 and UBUNTU64. (Actually this is a kind of workaround already.) Additionally if the scripts identifies the machine it's running on as a virtual box then the class VIRTXEN or VIRTVMW gets set accordingly. (I also need this later on to install XenTools / VMwareTools.)

Now when it comes to choosing a kernel image i'd like to be able to do the following

if it's a physical debian 32bit -> install linux-image-686
if it's a physical debian 64bit -> install linux-image-amd64
if it's a physical ubuntu -> install linux-image-server
if it's a xen-virtualised debian 32bit -> install linux-image-xen-686
if it's a xen-virtualised debian 64bit -> install linux-image-xen-amd64
if it's a xen-virtualisted ubuntu -> install linux-image-xen
(treat vmware / VIRTVMW as a physical server)

the package_config/DEFAULT may possibly look something like this:

PACKAGES aptitude DEBIAN and I686
linux-image-686
memtest86+

PACKAGES aptitude DEBIAN and AMD64
linux-image-amd64
memtest86+
[...]
PACKAGES aptitude DEBIAN and I686 and VIRTXEN
linux-image-686-
linux-image-686-xen
[...]

Is this possible? Or is there a better / different way?

tschüß
thomas




appended for reference:
=== Detecting operating system ===
class/15-osdetect

#! /bin/bash

# Debian? Ubuntu?
if [ -x /usr/bin/lsb_release ] ; then
 FLAVOUR=$(lsb_release -i|cut -f2|tr a-z A-Z)

 # 32 or 64bit?
 ARCH=$(uname -m)

 case $ARCH in
# old style
   i686)
     echo ${FLAVOUR}32
     ;;
   amd64)
     echo ${FLAVOUR}64
     ;;

# new style
   x86_32)
     echo ${FLAVOUR}32
     ;;
   x86_64)
     echo ${FLAVOUR}64
     ;;
 esac

fi

exit 0


=== virtualization software ===
class/90-vmdetect

#! /bin/bash

# Physical? Virtualized?

# Xen?
# There are some ACPI messages
if [ x"$(dmesg|grep "ACPI.*Xen")" != x ] ; then
       echo VIRTXEN
fi

# VMware?
# The harddisk VendorID is quite telling
DISKVENDORID=`dmesg|grep "Vendor: "|cut -d" " -f4`

if [ x${DISKVENDORID} = xVMWARE ] ; then
       echo VIRTVMW
fi

exit 0

Antwort per Email an