2 # This file is part of Ian Kelling's automated-distro-installer
3 # Copyright (C) 2024 Ian Kelling
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # For using some fai commands outside of fai.
20 # Usually this is sourced from another script. Note this has
21 # paths specific to Ian's machine.
22 # to set fai classes, export CLASS_CLASSNAME=true
23 # This wrapper can be detected by using this var:
24 export FAI_WRAPPER
=true
27 local var
=${1/#/CLASS_}
28 [[ $HOSTNAME == "$1" ||
${!var} ]]
32 # export class vars with CLASS_ in front to avoid name collisions.
34 export CLASS_
$class=true
36 classes
="${classes# }"
39 eval-fai-classfile
() {
41 if [[ ! -s $file ]]; then
42 echo "$0: probably an error: eval-fai-classfile no such file: $file"
45 fai-setclass $
(bash
$file)
48 # DEFAULT is used by fcopy
49 classes
="DEFAULT $(hostname)"
50 export CLASS_DEFAULT
=true
51 if [[ ! -d $FAI_ROOT ]]; then
54 if [[ ! -d $FAI ]]; then
55 if [[ -d /a
/bin
/fai
/fai
/config
]]; then
56 export FAI
=/a
/bin
/fai
/fai
/config
58 echo "$0: error: could not find directory to set for FAI. currently FAI=$FAI"
63 eval-fai-classfile
$FAI/class
/50-host-classes
64 eval-fai-classfile
$FAI/class
/51-multi-boot