5efa7f1c87cb63181ad1e342d3c8b6848b652339
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 # DEFAULT is used by fcopy
35 classes
="DEFAULT $(hostname)"
36 export CLASS_DEFAULT
=true
37 if [[ ! -d $FAI_ROOT ]]; then
40 if [[ ! -d $FAI ]]; then
41 if [[ -d /a
/bin
/fai
/fai
/config
]]; then
42 export FAI
=/a
/bin
/fai
/fai
/config
44 echo "$0: error: could not find directory to set for FAI. currently FAI=$FAI"
49 eval-fai-classfile
$FAI/class
/50-host-classes
50 eval-fai-classfile
$FAI/class
/51-multi-boot