#!/bin/bash
. ./param_bash.ini

#######################extracting###############################################
if [ -d ${IKIT_FTP_DIR}/${SOFT_DIR}1 ] ; then
	mv $IKIT_FTP_DIR/${SOFT_DIR}1 $IKIT_FTP_DIR/${SOFT_DIR}1.temp
	rm -rf $IKIT_FTP_DIR/${SOFT_DIR}1.temp &
fi
cd $IKIT_FTP_DIR
${TAR} -xzvf ${LEGACY}.tar.gz >> $gen_log 2>&1
if [ "$?" != 0 ] ; then
    ERROR "Failed during extract of Rosetta Base package" "$0"
fi
cd ${IKIT_FTP_DIR}/${SOFT_DIR}1
cat ${IKIT_FTP_DIR}/${VER}.tar.gz_* | ${TAR} -xzvf - >> $gen_log 2>&1
if [ "$?" != 0 ] ; then
    ERROR "Failed during extraction of Rosetta Java tree" "$0"
fi
#################move dir SOFT_DIR to APP_HOME/SOFT_DIR#########################
mv ${IKIT_FTP_DIR}/${SOFT_DIR}1 ${APP_HOME}/${SOFT_DIR}${SLOT_NUMBER}
if [ "$?" != 0 ] ; then
    ERROR "Failed during move of Rosetta Base package to dps home" "$0"
fi
####################create links to global product##############################
cd ${IKIT_DIR}
bash create_prod_links ${APP_HOME}/${SOFT_DIR}${SLOT_NUMBER} $MAIN_PRODUCT
exit 0
################################################################################
