case "$MODE" in
    configure)
        OVERRIDE_EXPORTS=${OVERRIDE_EXPORTS:-"false"}
        ;;
    finalization)
        # Export LTSP chroot using NFS to the LTSP client network
        check_exports=/etc/exports
        for x in /etc/exports.d/*.exports ; do
            if [ -f "$x" ]; then
                check_exports="$check_exports $x"
            fi
        done
        if ! grep -q "^$BASE" $check_exports ; then
            if [ -z "$NFS_EXPORT_STRING" ]; then
                NFS_EXPORT_STRING='*(ro,no_root_squash,async,no_subtree_check)'
            fi
            if [ "$OVERRIDE_EXPORTS" = "true" ]; then
                cat <<EOF >> /etc/exports
# Automatically added by ltsp-server
$BASE       $NFS_EXPORT_STRING
EOF
                invoke-rc.d nfs-kernel-server reload
            else
                cat <<EOF
WARNING: no entry for $BASE in /etc/exports,
you may want to add the following line to /etc/exports:

$BASE       $NFS_EXPORT_STRING

and then run the command:

invoke-rc.d nfs-kernel-server reload
EOF
            fi
        fi
        ;;
esac
