#!/bin/sh


# current first maximum replicated volume id
cd /vice/vol
echo 2130706432 > maxgroupid

#
# setting up servers file
#

id=""
echo
echo Setting up servers file.
cd /vice/db
until [ x$id != x ]; do
   echo -n 'Enter an id for this server (a number > 0 < 255) : '
   read id
   if [ x$id != x ]; then
      echo "Coda servers file" > servers
      echo -n "`hostname`		$id" >> servers
   fi
done
echo done!

#
# making hosts file
#

hn=`hostname`
bn=${hn%%.*}
if [ x$bn = x ]; then
    bn=$hn
fi

#
#  this is the scm so put hostname in /vice/db/scm
#
echo $bn > /vice/db/scm

ip=""

echo 
echo We are setting up a hostfile.  Sorry this is a bit primitive right now!
until [ x$ip != x ]; do
    echo -n "Enter the ip address of this host : "
    read ip
    if [ x$ip != x ]; then
       echo "$ip	$bn scm localhost" > /vice/db/hosts
    fi
done

#
# set up the initial VSG on the SCM; this is the SCM itself only. 
#
echo "Initializing the VSGDB to contain the SCM as E0000100"
echo E0000100 $bn > /vice/db/VSGDB
echo /vice/db/VSGDB set up

id=""
echo
echo Setting up ROOTVOLUME file
cd /vice/db
until [ x$id != x ]; do
   echo -n 'Enter the name of the rootvolume (< 32 chars) : '
   read id
   if [ x$id != x ]; then
	echo $id > /vice/db/ROOTVOLUME
   fi
done
echo done!
echo 
echo "** When srv, updatesrv and updateclnt are running, "
echo "** and you have a data partition PART (such as /vicepa) issue "
echo "** the command createvol $id  scm-hostname PART"
echo


