#!/bin/sh
# BLURB gpl
# 
#                            Coda File System
#                               Release 5
# 
#           Copyright (c) 1987-1999 Carnegie Mellon University
#                   Additional copyrights listed below
# 
# This  code  is  distributed "AS IS" without warranty of any kind under
# the terms of the GNU General Public Licence Version 2, as shown in the
# file  LICENSE.  The  technical and financial  contributors to Coda are
# listed in the file CREDITS.
# 
#                         Additional copyrights
#                            none currently
# 
#*/

# frobnicate /etc/services
NEWSERVICES=/tmp/services.$$

if grep coda_filesrv /etc/services >/dev/null ; then 
echo Removing old Coda entries from /etc/services..
perl -n -e 'if ( ! /^coda/ ) { print ; }'  < /etc/services > $NEWSERVICES
mv $NEWSERVICES /etc/services
rm $NEWSERVICES
fi 

if grep rpc2portmap /etc/services >/dev/null ; then 
echo "/etc/services already has new services registered! Good."
else 
cat <<EOF >> /etc/services
# Iana allocated Coda filesystem port numbers
rpc2portmap     369/tcp    
rpc2portmap     369/udp    # Coda portmapper
codaauth2       370/tcp    
codaauth2       370/udp    # Coda authentication server

venus           2430/tcp   # codacon port
venus           2430/udp   # Venus callback/wbc interface 
venus-se        2431/tcp   # tcp side effects
venus-se        2431/udp   # udp sftp side effect
codasrv         2432/tcp   # not used
codasrv         2432/udp   # server port
codasrv-se      2433/tcp   # tcp side effects
codasrv-se      2433/udp   # udp sftp side effect
EOF
fi

echo "/etc/services ready for Coda"
