#!/bin/sh

. ./param_bash.ini

csh -fc "source ${APP_HOME}/${SOFT_DIR}${SLOT_NUMBER}/profile/.cshrc; env"  | sed 's/^\([^=]*\)=\(.*\)/export \1="\2"/'  > ./tmp/env.$$
. ./tmp/env.$$ >& /dev/null
export >/dev/null
if [ ${PROMPT_FOR_ORA_PASS} = "Y" ] ; then
    $exl_util/put_ora_passwd EXL_ADMIN ${EXL_ADMIN_PASSWD}
    $exl_util/put_ora_passwd EXL ${EXL_PASSWD}
    $exl_util/put_ora_passwd CTXSYS ${CTXSYS_PASSWD}
else
    sqlplus -L -S $DB_USER/$DB_PASSWD@$ORACLE_HOST.$ORACLE_SID < /dev/null
    if [ "${?}" != "0" ] ; then
            LOG "Failed Connecting to DB with $DB_USER/$DB_PASSWD@$ORACLE_HOST.$ORACLE_SID"
            exit 1
    fi
    sqlplus -L -S EXL_ADMIN/${EXL_ADMIN_PASSWD}@$ORACLE_HOST.$ORACLE_SID < /dev/null
    if [ "${?}" != "0" ] ; then
            cd $IKIT_FTP_DIR/oracle/11
            printf "EXL\n" | csh -f create_role_profile $DB_PASSWD batch >> $gen_log 2>&1
            printf "EXL\n" | csh -f create_admin_user $DB_PASSWD batch >> $gen_log 2>&1
    fi
fi
########################################
cd ${dps_util}
csh -f init_dps.csh ${PROMPT_FOR_ORA_PASS}
if [ "${?}" != "0" ] ; then
    exit 1
else
    exit 0
fi

