#!/bin/sh
# $Header: /afs/athena.mit.edu/astaff/project/layerdev/src/conf/rsaix/RCS/afs.add,v 1.2 94/07/18 17:59:11 probe Exp $

STATE=$1
SRCDIR=$2

if [ ! -d /usr/vice ]; then
	mv -f /usr/vice /usr/vice.old
	ln -s /var/athena/usr/vice /usr/vice
fi

test -d /usr/vice/cache || mkdir /usr/vice/cache

if [ ! -d /usr/vice/etc/dkload ]; then
	mkdir /usr/vice/etc/dkload
	cp -p /afs/athena.mit.edu/system/layer/rsaixbin/dkload/* /usr/vice/etc/dkload
fi

rm -f /usr/vice/etc/afsd
cp -p /afs/athena.mit.edu/system/layer/rsaixbin/afsd /usr/vice/etc/afsd

if [ ! -f /usr/vice/etc/cacheinfo ]; then
	(  /bin/df /usr/vice/cache/ ; /bin/du -s /usr/vice/cache/ ) | \
	 /bin/awk ' \
		(NR == 2) { free = $4 + ($3 * y); } \
		(NR == 3) { x = int((free+$1*(1-y)-3000)*3/4); \
			if (x < 2000) { x = 2000 } ; \
			if (x > 100000) { x = 100000 } ; \
			printf("/afs:/usr/vice/cache:%d\n",x);}' \
	 > /usr/vice/etc/cacheinfo
fi

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

exit 0
