main fai scripts can run outside of fai, fixup stuff
[automated-distro-installer] / fai-wrapper
diff --git a/fai-wrapper b/fai-wrapper
new file mode 100644 (file)
index 0000000..8b44a6f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# for using some fai commands outside of fai
+ifclass() {
+    local var=${1/#/CLASS_}
+    [[ $HOSTNAME == $1 || ${!var} ]]
+}
+export -f ifclass
+classes=  # used by fcopy
+for x in $(bash /a/bin/fai/config/class/50-host-classes); do
+    # export class vars with CLASS_ in front to avoid name colissions.
+    classes+=" $x"
+    export CLASS_$x=true
+done
+classes="${classes# }"
+export classes
+export FAI_ROOT=/
+export FAI=/a/bin/fai/config