# $Id$

if [ `id -u` != "0" ]; then
  echo "Must be root; current id="`id -u`
  exit 1
fi

umask 022
if [ ! -d /afs ]; then
  mkdir /afs
fi

chown root.bin /usr/vice /usr/vice/cache
chown -R root.bin /usr/vice/bin /usr/vice/etc

strip -x /usr/vice/bin/*

echo "Fetching CellServDB..."
ftp -o /usr/vice/etc/CellServDB http://grand.central.org/dl/cellservdb/CellServDB

echo -n 'Please enter your cell name: '
sh -c 'read; echo $REPLY >/usr/vice/etc/ThisCell'

if ! grep -q '^\. /usr/vice/etc/rc.securelevel.afs' /etc/rc.securelevel; then
  echo 'adding rc.securelevel.afs to /etc/rc.securelevel'
  echo '. /usr/vice/etc/rc.securelevel.afs' >>/etc/rc.securelevel
else
  echo 'rc.securelevel.afs is already in /etc/rc.securelevel'
fi

echo 'Reboot to start OpenAFS.'
