#!/bin/bash

### BEGIN SUBROUTINE INFO
# Provides-Var:
# Requires-Var:    $FAI_CONFIG_SRC
# Suggests-Var:
# Short-Description: get $FAI by local path
### END SUBROUTINE INFO

# detect local config space
# check if /media/data direcort contain a config space
# otherwise try default path

localpath=/media/data/config

if [ -d $localpath ]; then
    echo "Config space detected in $localpath."
    mount --bind $localpath $FAI
elif [ -d /var/lib/fai/config ]; then
    echo "Using default config space in /var/lib/fai/config"
else
    echo "ERROR: No config space deteced."
fi
