2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
5 # For using some fai commands outside of fai.
6 # Usually this is sourced from another script. Note this has
7 # paths specific to Ian's machine.
8 # to set fai classes, export CLASS_CLASSNAME=true
9 # This wrapper can be detected by using this var:
10 export FAI_WRAPPER
=true
13 local var
=${1/#/CLASS_}
14 [[ $HOSTNAME == $1 ||
${!var} ]]
18 # export class vars with CLASS_ in front to avoid name collisions.
20 export CLASS_
$class=true
22 classes
="${classes# }"
25 eval-fai-classfile
() {
27 if [[ ! -s $file ]]; then
28 echo "$0: probably an error: eval-fai-classfile no such file: $file"
31 fai-setclass $
(bash
$file)
34 classes
=DEFAULT
# used by fcopy
35 export CLASS_DEFAULT
=true
36 if [[ ! -d $FAI_ROOT ]]; then
39 if [[ ! -d $FAI ]]; then
40 if [[ -d /a
/bin
/fai
/fai
/config
]]; then
41 export FAI
=/a
/bin
/fai
/fai
/config
43 echo "$0: error: could not find directory to set for FAI. currently FAI=$FAI"
48 eval-fai-classfile
$FAI/class
/50-host-classes
49 eval-fai-classfile
$FAI/class
/51-multi-boot