Hi both, thank you for your replies.
@Thomas: As of now your proposal or the workaround I am using currently are both OK for me. Additionally I understood that this is more like a "logical bug" and not really the wanted behavior, but changing is not easily possible on a quick fix. As of today I am on another project but maybe in future I have some spear time to check the "install_packages" script in more detail and make a proposal. @Matteo: Thanks for the provided information & code. (I have something more or less similar in use) Unfortunately this is not really a solution related to the problem since the definition of classes within $classes variable / FAI_CLASSES file does not correctly take place here. Due to this independently of the definition order of defined classes the wrong / correct package actions are applied depending on classes order within install_packages config file. Am Mo., 6. Mai 2019 um 21:18 Uhr schrieb Matteo Guglielmi < matteo.guglie...@dalco.ch>: > This is how I solved my needs to handle or adjust the > > order of classes in FAI. > > > > In my case, I always wanted to define the "essential" > > classes in: > > > 50-host-classes > > > and leaving the job of filing up the voids (or even > > remove or change the order of classes) to a secondary > > script (in my case '60-expand-classes'). > > > > If you find this useful, you are welcome to use it. > > > > > ### > > > > cat /srv/fai/config/hooks/subroutines > > > > > prependClass() { > sed -ri "/^$2$/i $1" /tmp/fai/FAI_CLASSES > } > > appendClass() { > sed -ri "/^$2$/a $1" /tmp/fai/FAI_CLASSES > } > > deleteClass() { > sed -ri "/^$1$/d" /tmp/fai/FAI_CLASSES > } > > replaceClass() { > sed -ri "/^$2$/c $1" /tmp/fai/FAI_CLASSES > } > > listClasses() { > cat /tmp/fai/FAI_CLASSES > } > > assertUfbiClasses() { > grep -q '^UFBI' /tmp/fai/FAI_CLASSES || return 1 > } > > > > > cat /srv/fai/config/class/50-host-classes > > > > > case $HOSTNAME in > node01) > echo CENTOS75 MLKERNEL UFBIMONITOR UFBIOFED UFBISLURM > ;; > node02) > echo CENTOS76 LTKERNEL UFBIMONITOR UFBIOFED UFBISLURM > ;; > node03) > echo CENTOS75 MLKERNEL UFBIMONITOR UFBIOFED UFBISLURM > ;; > node04) > echo CENTOS76 LTKERNEL UFBIMONITOR UFBIOFED UFBISLURM > ;; > *) > echo CENTOS76 > ;; > esac > > > > > cat /srv/fai/config/class/60-expand-classes > > > > if ifclass AMD64 ; then > appendClass FAIBASE AMD64 > else > exit 700 # we don't support 32-bit OSes > fi > > if ifclass -o CENTOS75 CENTOS76 ; then > prependClass CENTOS 'CENTOS7[5-6]' > > if ifclass -o LTKERNEL MLKERNEL ; then > if ifclass UFBIOFED ; then > replaceClass UFBIIB UFBIOFED > fi > fi > fi > > if ifclass -o SLES150 SLES151 ; then > prependClass SLES 'SLES15[0,1]' > fi > > if ifclass UBUNTU18 ; then > prependClass UBUNTU UBUNTU18 > fi > > if ifclass DEBIAN9 ; then > prependClass DEBIAN DEBIAN9 > fi > > if assertUfbiClasses ; then > ifclass UFBI || echo UFBI > fi > > > [ -d /sys/firmware/efi ] && echo EFI || echo BIOS > > > > ________________________________ > From: linux-fai <linux-fai-boun...@uni-koeln.de> on behalf of Thomas > Lange <la...@informatik.uni-koeln.de> > Sent: Monday, May 6, 2019 10:34:40 AM > To: fully automatic installation for Linux > Subject: Re: package uninstall & install - different classes > > Your observation is correct. The order of classes are important when > selecting configuration files, but do not matter inside a > package_config file itself. The script install_packages reads the files in > subdirectory package_config in the order given by the classes. But each > file is read from the beginning to the end. If a line > PACKAGE install CLASSA > is found it justs checks if CLASSA is also defined, otherwise skips > this part. So inside thise config the class is more like a true/false flag. > > It's not easy to change this, because you can list multiple classes > after the PACKAGE install marker which forms a logical OR > function. It's then hard to decide to which class the packages listed > should be assigned to. > > In your case, is it possible to change your config by creating two > files named CLASS1 and CLASS2 which each include a section PACKAGES > install STRETCH64? Would that help you? > > -- > regards Thomas >