+ # if this computer has ethernet, we could setup a br0 like so:
+ # cat <<'EOF'
+ # fai-rvm error: no bridge detected. add one to interfaces like this:
+ # iface eth0 inet manual
+ # iface br0 inet dhcp
+ # bridge_ports eth0
+ # bridge_stp off
+ # bridge_maxwait 0
+ # EOF
+
+ # if we only have wifi, cant use eth0
+ net_arg="-w network=default,mac=52:54:00:9c:ef:ad"
+fi
+
+if [[ $this_dir == /a/bin/* ]]; then
+ # Copy our script elsewhere so we can develop it
+ # and save it at the same time it's running
+ rm -rf /tmp/faifreeze
+ cp -ar /a/bin/fai /tmp/faifreeze
+ exec /tmp/faifreeze/${BASH_SOURCE##*/} "${orig_args[@]}"
+fi
+
+
+is_arch_revm() {
+ [[ ${0##*/} == arch-revm ]]
+}
+
+err-cleanup() {
+ echo "doing cleanup"
+ if [[ -e /tmp/fai-revm-did-pxe ]]; then
+ e ./pxe-server $dhcp_arg
+ fi
+ ./faiserver-disable
+}
+
+boot_arg=--pxe
+if is_arch_revm; then
+ e ./pxe-server $dhcp_arg demohost arch
+ touch /tmp/fai-revm-did-pxe
+ sleep 2
+ # via osinfo-query os. guessing arch is closest to latest fedora.
+ variant=fedora22
+else
+ if $pxe; then
+ e ./pxe-server $dhcp_arg demohost fai
+ touch /tmp/fai-revm-did-pxe
+ sleep 2
+ else
+ killall fai-monitor &>/dev/null ||:
+ fai-monitor &
+ if [[ ! $BASEFILE_DIR ]]; then
+ BASEFILE_DIR=/tmp
+ fi
+ isopath=$BASEFILE_DIR/$iso
+ isosrc=$BASEFILE_DIR/BOOKWORM64.tar.zst
+ if [[ ! -e $isopath || $(stat -c %Y $isopath) -lt $(stat -c %Y $isosrc) ]]; then
+ e fai-cd -g $(readlink -f grub.cfg.${iso%%.*}) -f -A $isopath