#!/bin/sh
#
# @(#)db_scatter.sh	3.3 04/13/99 Sun Microsystems, Inc.
#
# Undo the actions of 'db_gather', instantiating the data into databases
# in the current directory.
#

read SUNSCREEN_BASE <${SUNSCREEN_ETC:-/etc/opt/SUNWicg/SunScreen}/location
. $SUNSCREEN_BASE/bin/.ssenv.profile

CMDauthuser="$LIB_DIR/authuser -d . store"
CMDproxyuser="$LIB_DIR/proxyuser -d . store"
CMDvars="$LIB_DIR/vars -d . store"
CMDlogmacro="$LIB_DIR/logmacro -d . store"

mkdir .ezdb .ezdb/auth_user.d .ezdb/proxy_user.d .ezdb/vars.d

error=false
sed -n -e "s=^@db ==p" |
while read type obj
do case $type in
   vars)	$CMDvars	"$obj" || error=true;;
   logmacro)	$CMDlogmacro	"$obj" || error=true;;
   authuser)	$CMDauthuser	"$obj" || error=true;;
   proxyuser)	$CMDproxyuser	"$obj" || error=true;;
   esac
done

if $error
then echo>&2 "Failed to activate ezdb data."
     exit 1
fi
