#!/bin/sh

#######################################################
#
#    update /etc/exports file, if needed
#
#######################################################

if [ "$2" ]
then
	NETWORK=$1
	NETMASK=$2
else
	NETWORK="192.168.0.0"
	NETMASK="255.255.255.0"
fi

if [ ! "`grep /opt/ltsp/i386.*$NETWORK /etc/exports`" ] ; then

echo "## LTS-begin ##
#
# The lines between the 'LTS-begin' and the 'LTS-end' were added
# on: Wed Nov 28 11:19:42 PST 2001 by the ltsp installation script.
# For more information, visit the ltsp homepage
# at http://www.ltsp.org
#

/opt/ltsp/i386            $NETWORK/$NETMASK(ro,no_root_squash,sync)
/var/opt/ltsp/swapfiles   $NETWORK/$NETMASK(rw,no_root_squash,async)

#
# The following entries need to be uncommented if you want
# Local App support in ltsp
#
#/home                    $NETWORK/$NETMASK(rw,root_squash,sync)


## LTS-end ## 
" >> /etc/exports 
fi

if [ ! "`grep /usr/X11R6/lib/X11/fonts.*$NETWORK /etc/exports`" ] ; then

echo "## LTS-begin ##
#
# The lines between the 'LTS-begin' and the 'LTS-end' were added
# on: Wed Nov 28 11:19:42 PST 2001 by the ltsp installation script.
# For more information, visit the ltsp homepage
# at http://www.ltsp.org
#

/usr/X11R6/lib/X11/fonts   $NETWORK/$NETMASK(ro,no_root_squash,sync)
/usr/share/AbiSuite/fonts  $NETWORK/$NETMASK(ro,no_root_squash,sync)
/usr/share/fonts           $NETWORK/$NETMASK(ro,no_root_squash,sync)
/usr/lib/openoffice/share/fonts $NETWORK/$NETMASK(ro,no_root_squash,sync)

## LTS-end ## 


## LTS-end ## 
" >> /etc/exports 
fi

if [ ! "`grep /opt/ltsp/ppc.*$NETWORK /etc/exports`" ] ; then
echo "## LTS-begin ##
#
# The lines between the 'LTS-begin' and the 'LTS-end' were added
# on: Wed Nov 28 11:19:42 PST 2001 by the ltsp installation script.
# For more information, visit the ltsp homepage
# at http://www.ltsp.org
#

/opt/ltsp/ppc            $NETWORK/$NETMASK(ro,no_root_squash,sync)

## LTS-end ## 
" >> /etc/exports 
fi


#######################################################
#
#  update /etc/hosts.allow, if needed
#
#######################################################

NETWORK=`echo $NETWORK|sed s/[.]0//g`

if [ ! "`grep ^in.tftpd:.*$NETWORK /etc/hosts.allow`" ]
then

echo "## LTS-begin ##
#
# The lines between the 'LTS-begin' and the 'LTS-end' were added
# on: Wed Nov 28 11:19:42 PST 2001 by the ltsp installation script.
# For more information, visit the ltsp homepage
# at http://www.ltsp.org
#

bootpd:    0.0.0.0
in.tftpd:  $NETWORK.
portmap:   $NETWORK.

## LTS-end ##
"  >> /etc/hosts.allow 
fi
