#!/bin/bash # This script will: # - deliver the instantiation files of this class to each defined FEC # - deliver the test-deploymentUnit, which is has to be passed as parameter # - generate a start-script for each FEC # Script written by Alexander Schwinn - 20.05.2011 #Define command to leave this script if [ ${BASH_SOURCE[0]} == $0 ]; then #script is called from within another script. Means we have to use exit to leave LEAVE_FEC_DELIVER_SCRIPT=exit else #script is sourced (called from a console) means we need to use return (exit would close the console) LEAVE_FEC_DELIVER_SCRIPT=return fi # Check Parameters if [ $# -ne 2 ];then echo "Error: Wrong number of parameters" echo "Use: ./FEC.deliver.script [DeploymentUnitName] [CPU] to run this script" ${LEAVE_FEC_DELIVER_SCRIPT} 1 fi DEPLOY_UNIT_NAME=$1 CPU=$2 if [ ${CPU} != "i686" ];then echo "Error: Processor Type not supported" echo "Supported processors are:" echo "1: i686" ${LEAVE_FEC_DELIVER_SCRIPT} 1 fi # Check If we are in the rigth folder if test -d ${DEPLOY_UNIT_NAME}; then echo "" else echo "Error: You have to start this shell-script in the Test-directory of your FESA3 class!" ${LEAVE_FEC_DELIVER_SCRIPT} 1 fi FESA_RELEASE=3.0-beta DEPLOY_UNIT_VERSION=0 #only possible to set for DeployUnit projects CLASS_NAME=`echo $PWD | rev | cut -d"/" -f 4 | rev` DELIVER_DIR_BINARY=/common/usr/export/fesa/arch/${CPU}/eqp_software/${DEPLOY_UNIT_NAME}/v${DEPLOY_UNIT_VERSION} DELIVER_DIR_INSTANCE=/common/usr/export/fesa/data DELIVER_DIR_STARTSCRIPT=/common/usr/export/fesa/local LOCAL_DELIVERY_DIR=../../bin/${CPU} INSTALL=". /common/fesa/${FESA_RELEASE}/fesa-environment-gsi/${FESA_RELEASE}/FesaGSI.install.script" #get all direct subfolders, exclusing asl* --> no delivery for asl cluster! FOLDERS=$(find . -maxdepth 1 -type d ! -iname '*asl*') if [ "${FOLDERS}" == "" ]; then echo "Error: No valid FEC found ... operation canceled. ( the asl7xx computers are no valid delivery target)" ${LEAVE_FEC_DELIVER_SCRIPT} 1 fi for FEC in ${FOLDERS} ; do #remove leading "./" from FEC FEC=`echo $FEC | rev | cut -d"/" -f 1 | rev` if test -f ${FEC}/${CLASS_NAME}DeviceData.instance; then echo Delivering ${FEC}/${CLASS_NAME}DeviceData.instance to ${DELIVER_DIR_INSTANCE}/${FEC}/development/fesa-data/ ${INSTALL} ${FEC}/${CLASS_NAME}DeviceData.instance ${DELIVER_DIR_INSTANCE}/${FEC}/development/fesa-data/ START_SCRIPT_FOLDER=${DELIVER_DIR_STARTSCRIPT}/${FEC}/scripts/development START_SCRIPT=${START_SCRIPT_FOLDER}/${DEPLOY_UNIT_NAME}.v${DEPLOY_UNIT_VERSION} echo Creating Startscript: ${START_SCRIPT} #create scripts folder, if not already there mkdir -p ${START_SCRIPT_FOLDER} #remove script if already there if test -f ${START_SCRIPT}; then rm ${START_SCRIPT} fi touch ${START_SCRIPT} #create chmod ugo+x ${START_SCRIPT} #make executable echo "#!/bin/sh" >> ${START_SCRIPT} echo ". /opt/fesa/global/etc/fesa/${FESA_RELEASE}/fesa-environment-gsi/${FESA_RELEASE}/fesa3_environment.conf" >> ${START_SCRIPT} # We directly add launch for split and unsplit BINARY_PATH=/opt/fesa/arch/eqp_software/${DEPLOY_UNIT_NAME}/v${DEPLOY_UNIT_VERSION}/development echo "${BINARY_PATH}/${DEPLOY_UNIT_NAME}_M0.${DEPLOY_UNIT_VERSION}.${CPU} -rtprio 70" >> ${START_SCRIPT} echo "${BINARY_PATH}/${DEPLOY_UNIT_NAME}_S0.${DEPLOY_UNIT_VERSION}.${CPU} -rtprio 70" >> ${START_SCRIPT} echo "${BINARY_PATH}/${DEPLOY_UNIT_NAME}_R0.${DEPLOY_UNIT_VERSION}.${CPU} -rtprio 70" >> ${START_SCRIPT} fi done echo Delivering binaries to ${DELIVER_DIR_BINARY}/development ${INSTALL} ${DEPLOY_UNIT_NAME}/*.${CPU} ${DELIVER_DIR_BINARY}/development ${LEAVE_FEC_DELIVER_SCRIPT} 0