#!/bin/sh
# BLURB gpl
# 
#                            Coda File System
#                               Release 6
# 
#           Copyright (c) 1987-2003 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
# 
#*/

# ignore SIGHUP
trap "" 1

prefix=/usr/pkg
exec_prefix=${prefix}
if [ -f ${prefix}/etc/coda/server.conf ] ; then
  . ${prefix}/etc/coda/server.conf
  serverconf=1
else
  serverconf=0
fi

if [ x${vicedir} = x ]; then
  vicedir=/vice
fi

# Rotate logfiles
${exec_prefix}/sbin/coda-server-logrotate

rm -f ${vicedir}/srv/CRASH

if [ -f ${vicedir}/srv/ZOMBIFY ]; then
    XFLAGS=-zombify
fi

# pass on arguments to srv
# The -rvm flag takes 3 arguments. The first is the log device/file,
# the second is the data segment device/file, and the third is the
# length of the file or device holding the RVM data segment.
# These parameters are normally taken from ${vicedir}/srv.conf

if [ ${serverconf} = 0 ] ; then
  RVMFLAGS=`grep '^\-rvm ' ${vicedir}/srv.conf`
fi
${exec_prefix}/sbin/codasrv $* $XFLAGS $RVMFLAGS

