#!/bin/bash
# Author: Steven Shiau <steven _at_ clonezilla org>
# License: GPL
#
# generate the NFS exports or clean the old one.

# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions

# calculate the number of the NFS daemon 
total_client_no="$(get-client-ip-list | wc -l)"
[ -z "$total_client_no" ] && exit 1
nfsd_no="$(echo "scale=0; $NFSD_RATIO * $total_client_no / 1" | bc -l)"
[ "$nfsd_no" -ge $NFSD_MAX ] && nfsd_no=$NFSD_MAX

echo "$nfsd_no"
