table of contents
other versions
- wheezy 4.0.8~deb7u1
- jessie 4.3.1+deb8u1
- jessie-backports 5.3.6~bpo8+1
- testing 5.3.6
- unstable 5.3.6
fai-class(1) | fai-class(1) |
NAME¶
fai-class - define classes using files and scripts.SYNOPSIS¶
fai-class [OPTION] DIRECTORY CLASSFILEDESCRIPTION¶
fai-class executes scripts in DIRECTORY to define classes. All classes are written to CLASSFILE, each class on a separate line. Use absolute paths for both arguments. All scripts or executables matching "[0-9][0-9]*" are executed in alphabetical order. They can define classes by writing the names of the classes to stdout. Classes can be separated by spaces or written one on a line. All lines that start with a "#" are comment lines and are ignored.OPTIONS¶
- -d
- Create debugging output.
- -h
- Show help, version and summary of options.
- -T
- Test if classes in CLASSFILE are defined multiple times. This should never happen. The test is executed after the classes are defined.
- -t tmpdir
- The file additional-classes is read from the directory tmpdir. Default value is /tmp/fai/.
- -v
- Create verbose output.
EXAMPLES¶
In FAI, fai-class is used in the following way:# fai-class /fai/class /tmp/fai/FAI_CLASSES
classes=`cat /tmp/fai/FAI_CLASSES`
EXAMPLES FOR SCRIPTS¶
This is the script 01alias: #! /bin/sh catnc() { # cat but no comment lines grep -v "^#" $1 } # echo architecture in upper case dpkg --print-architecture | tr /a-z/ /A-Z/ uname -s | tr /a-z/ /A-Z/ # all hosts named ant?? use the classes in file anthill case $HOSTNAME in ant??) catnc anthill ;; esac # a Beowulf cluster; all nodes except the master node # use classes from file class/atoms case $HOSTNAME in atom00) echo BEOWULF_MASTER ;; atom??) catnc atoms ;; esac # if host belongs to class C subnet 123.45.6.0 use class NET_6 case $IPADDR in 123.45.6.*) echo NET_6 ;; esac Another EXAMPLE: The script 24nis: #! /bin/sh # add NIS and the NIS domain name if YPDOMAIN is defined if [ -n "$YPDOMAIN" ];then echo "NIS $YPDOMAIN" | tr /.a-z-/ /_A-Z_/ else echo NONIS fi
ADDCLASSES=CLASS1,CLASSX,CLASS3
NOTES¶
All class names should be written in uppercase letters (execpt the class of the hostname). Do not use a dash, use an underscore. Only executable scripts in DIRECTORY are used. CLASSFILE is removed before writing to it. Scripts should not directly write to CLASSFILE. LOGDIR should not be writable for everybody.SEE ALSO¶
This program is part of FAI (Fully Automatic Installation). The FAI homepage is http://fai-project.org.AUTHOR¶
Written by Thomas Lange <lange@informatik.uni-koeln.de>4 October 2011 | FAI 4 |