#!/bin/bash

. ${TOOLKIT}-functions.sh

#----------------------------------------------------------------
# builds /etc/exports
#----------------------------------------------------------------

file=exports
outfile=$file.tmp
cp $file.base $outfile || exit $?

myself=`uname -n`
myself_short=`uname -n | sed -e 's/\..*//'`

for share in `jtconf --list shares.nfs. | sort`
do
	server=`jtconf $share.server`		|| exit_missing_define $share.server
	remote=`jtconf $share.remote`		|| exit_missing_define $share.remote
	opts=`	jtconf $share.opts_server`	|| exit_missing_define $share.opts_server

	[ $server == $myself -o $server == $myself_short ] && {
		printf "  %-10s : %s %s\n" `echo $share | sed -e 's/.*\.//'` $remote "$opts"
		echo "$remote $opts" >>$outfile
	}
done

exit 0
