#!/bin/ksh
#
# ident "@(#)bbdownload.sh 1.2     01/05/30 SMI"
#
# Copyright (c) 2000 by Sun Microsystems, Inc.
# All rights reserved.
#                       
# translates the unix user to the corona token
# and downloads the user data from the portal
# $1 - unix user
# $2 - config file to use

. $BBROOT/etc/opt/SUNWbb/blackbox.rc
. $BBPATH/bin/bbupdnfunc

RES=0
TOKEN=`cat $BBLOCKPATH/$1.lock 2>/dev/null`

if [ ${#TOKEN} != 0 ]; then
	echo "BB download for user: $1, token: $TOKEN"
	# currently only moving files between the download
	# area and the final dest
	read_file down $2 $TOKEN
else
	echo "failed to get user token"
	RES=1
fi

exit $RES
