generate_param_info 1.93 KB
#!/bin/bash

if [[ -z ${NEWMETA+x} || -z ${AMDAINSTALLATION+x} ]]; then 
  echo "check if NEWMETA & AMDAINSTALLATION env variables are defined"
  exit
fi 
   
CRT_PWD=`pwd`

cd $AMDAINSTALLATION/AMDA_Kernel/app-generate-paraminfo
 
export PATH=$AMDAINSTALLATION/AMDA_Kernel/build/${BUILD_TYPE}/bin:$PATH
export DDPATH=$AMDAINSTALLATION/AMDA_Kernel/app-generate-paraminfo

PARAM_INFO_PATH=$NEWMETA/ParamInfo
if [ ! -d "$PARAM_INFO_PATH" ]; then
	mkdir "$PARAM_INFO_PATH"
fi

# if predefined param info exists - copy it to NEWMETA/ParamInfo 
# to avoid not needed calculations

if  [ -d $AMDAINTERNALDIR/PARAM_INFO_PREDEFINED ]; then
	cp $AMDAINTERNALDIR/PARAM_INFO_PREDEFINED/info*.xml $NEWMETA/ParamInfo
fi

#modif in app.properties
if [ ! -e ./app.properties ]; then
	echo "No app.properties file !!!"
	exit
fi

if [ -e ./app.properties.temp ]; then
	# rm ./app.properties.temp
	echo "Seems ./app.properties has been modified already"  
else
	while read line  
		do
			
			if [[ $line == app.param.path* ]]; then
				line="app.param.path="$NEWMETA"final/"
			fi
			
			if [[ $line == app.dataSetInfo.path* ]]; then
				line="app.dataSetInfo.path="$NEWMETA"datasets/"
			fi
			
			if [[ $line == app.user.name* ]]; then
				line="app.user.name="$DDUSER
			fi
					
			echo $line >> ./app.properties.temp
					
		done < <(cat $AMDAINSTALLATION/AMDA_Kernel/app-generate-paraminfo/app.properties)
		
	cp  ./app.properties.temp $AMDAINSTALLATION/AMDA_Kernel/app-generate-paraminfo/app.properties
fi 
   
   
DDLogin $DDUSER $DDPASS

for param_file in $NEWMETA/final/*.xml
do
    param_filename=$(basename "${param_file%.*}")    
    info_file=info_${param_filename}.xml
    
    if [ -e $NEWMETA/ParamInfo/$info_file ]
     then
       echo ${param_filename} exists
     else
      echo "Generate info file for ${param_filename}"
      amdaParameterInfo -p ${param_filename}
      if [ $? -eq 0 ]; then
         mv $info_file  $NEWMETA/ParamInfo
      fi
    fi
done;


cd ${CRT_PWD}