#!/bin/sh
exec 2>&1
. /etc/cfs.conf
umount $NULL_EXPORT >/dev/null 2>&1 || true
echo "$NULL_EXPORT localhost(rw)" > /etc/cfs.exports
if [ -x /usr/sbin/exportfs ]; then
  exportfs localhost:$NULL_EXPORT
fi
rpc.mountd -F -P3048 -f/etc/cfs.exports 2>/dev/null &
MOUNTD=$!
export NODAEMON=1
cfsd &
PID=$!
echo $PID
trap "kill -STOP $PID" STOP
trap "kill -CONT $PID" CONT
trap "kill -HUP $PID" HUP
trap "kill -ALRM $PID" ALRM
trap "kill -INT $PID" INT
trap "kill -TERM $PID ; umount $CRYPT_ROOT" EXIT 
mount -oport=3049,mountport=3048,intr,nfsvers=2 \
  localhost:$NULL_EXPORT $CRYPT_ROOT
kill -TERM $MOUNTD
wait $PID
